Using IF to remove upper and lower boundaries

3 views (last 30 days)
Within a FOR loop, I can successfully implement a single IF statement to prevent either the upper or lower values from being manipulated like so:
if (theta1 > 0.7297)
continue
end
However every attempt I have made to remove both upper and lower values has failed. Can anyone explain what is wrong with this:
if (theta1 > 0.7297)
else (theta1 < -0.7297)
continue
end
Thanks.

Accepted Answer

Arthur
Arthur on 29 Oct 2012
So you want to continue if theta1 > 0.7297 or if theta < -0.7297? Then you could test for both in the if statement:
if (theta1 > 0.7297) || (theta1 < -0.7297)
continue
end

More Answers (1)

Thomas
Thomas on 29 Oct 2012
Edited: Thomas on 29 Oct 2012
I think this is what you need
if (theta1 > 0.7297 || theta1 < -0.7297)
continue
end
You can enter both conditions in the single If statement.

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!