I got this this error when I run the program (Error while parsing expression)
조회 수: 8 (최근 30일)
이전 댓글 표시
I am using a function with different inputs but I got this error
Error while parsing expression: (((u(1))–(cax*(u(2))*(u(2)))–(jr*(u(5))*(u(3)))–((iz-iy)*(u(3))*(u(4))))/(ix)) in 'Final_Modelling_Sub/Quadcopter System Dynamics/Translational & Rotational Dynamics/Phidd Equation1' token "" was found, whereas ")" was expected

댓글 수: 0
채택된 답변
Walter Roberson
2021년 8월 7일
(((u(1))–(cax*(u(2))*(u(2)))–(jr*(u(5))*(u(3)))–((iz-iy)*(u(3))*(u(4))))/(ix))
That code is using unicode U+2013 "EN DASH" instead of U+002D "hyphen-minus" which is the - character
댓글 수: 4
Walter Roberson
2021년 8월 7일
S = '(((cos(u(2))*cos(u(4))*sin(u(3)))+(sin(u(2))*(sin(u(4)))*(u(1)))-(cdx*(u(5))))/(m)'
% 123 4 5 43 4 5 43 4 5 432 3 4 5 43 4 5 6 543 4 5 432 3 4 5 4321 2 1
sum(S == '(')
sum(S == ')')
21 open brackets, 20 closing brackets.
The numbers above are the number of bracket levels in effect "after" the character above has been executed. You can see that you get back to 1, but you should be getting back to 0 instead.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!