フィルターのクリア

if in for loop

2 ビュー (過去 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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by