필터 지우기
필터 지우기

if in for loop

조회 수: 1 (최근 30일)
atarli
atarli 2013년 10월 22일
답변: Walter Roberson 2013년 10월 22일
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?

답변 (1개)

Walter Roberson
Walter Roberson 2013년 10월 22일
if a(i+1) > a(i)
break
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by