Invalid escape sequence appears in format string. See help sprintf for valid escape sequences

4 visualizzazioni (ultimi 30 giorni)
I have the following set of fprintf statements.
magnaxialA=(Elem(i).Q(1,1)/1000);
magnshearA=(Elem(i).Q(2,1))/1000;
magnmomentA=(Elem(i).Q(3,1))/1000;
fprintf('\n\tStart Node\n')
fprintf('\Axial Force %f kN\n',abs(magnaxialA))
fprintf('\Shear Force %f kN\n',abs(magnshearA))
fprintf('\Moment %f kN-m\n',abs(magnmomentA))
But I keep getting the error message Invalid escape sequence appears in format string. See help sprintf for valid escape sequences

Risposta accettata

Image Analyst
Image Analyst il 11 Nov 2013
Get rid of the first backslash since \A, \S, and \M are invalid.
fprintf('\n\tStart Node\n')
fprintf('Axial Force %f kN\n',abs(magnaxialA))
fprintf('Shear Force %f kN\n',abs(magnshearA))
fprintf('Moment %f kN-m\n',abs(magnmomentA))

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by