An "if" statement is within another "if" statement which inside a "while" loop. How to end the second "if" statement when a condition is met in the first "if" without breaking the while loop? "return" in the first "if" just ends first "if"
Show older comments
if R3>R2 Ri=[R3; Yr]; for i=1:Nvar if any((X(:,i)<Xrange(1,i))|(X(:,i)>Xrange(2,i))) X=Xr; return end end
Answers (1)
Star Strider
on 14 Apr 2018
0 votes
Consider the continue statement as well, depending on what you want to do.
Experiment to get the result you want.
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!