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

조회 수: 4 (최근 30일)
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

채택된 답변

Image Analyst
Image Analyst 2013년 11월 11일
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))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by