why am I getting parse error as soon as I start loop ?
Show older comments
As soon as I type for, if etc. I get,
Parse error at <EOL>: usage might be invalid matlab syntax.
I get this error even if I do not write a single line of code.
3 Comments
Dyuman Joshi
on 12 Dec 2022
"I get this error even if I do not write a single line of code."
Did you try to run a script or function file?
Askic V
on 12 Dec 2022
loops such as "for" of "if" statements should be ended with a keyword "end".
Ashish Phadke
on 12 Dec 2022
Answers (1)
Walter Roberson
on 12 Dec 2022
1 vote
the expression for the condition of if or while must start on the same line, not the next line.
Comparisons are == not =
1 Comment
Ashish Phadke
on 20 Dec 2022
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!