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

9 views (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 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))

More Answers (0)

Categories

Find more on Argument Definitions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!