if in for loop

i want to control my for loop with if, for example:
for i=1:1:10
a(i)=...
a(i+1)=...
now i want to here make a comparision between a(i) and a(i+1) then if a(i+1)<a(i) i will be next value in for loop
But if a(i+1)>a(i) program should exit from the for loop. How can I do that?

Answers (1)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Asked:

on 22 Oct 2013

Answered:

on 22 Oct 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!