Invalid use of operator in for loop
Show older comments
Why am i getting an error message for this?
(am i also correct in using the '||' to mean 'or'?)
theta0 = tand(v0y/v0x)
for theta0 > 90 || theta0 < 0
% where the '>' gives an error message
end
if i switch the positions of the 'theta0 <0' and 'theta0 > 90' then i will get an error for the '<'
(whichever comes first has the error message)
Accepted Answer
More Answers (1)
Paul
on 22 Dec 2020
You're geting the error because that's the wrong syntax for a for loop:
doc for
Having said that, it kind of looks like you really want an if statement:
doc if
Categories
Find more on Loops and Conditional Statements 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!