I got this this error when I run the program (Error while parsing expression)
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohammed AL-hadi
am 7 Aug. 2021
Kommentiert: Mohammed AL-hadi
am 7 Aug. 2021
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 7 Aug. 2021
(((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 Kommentare
Walter Roberson
am 7 Aug. 2021
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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!