How to use break in for-if loop to get out of for loop?

1 回表示 (過去 30 日間)
reshdev
reshdev 2014 年 9 月 20 日
回答済み: the cyclist 2014 年 9 月 20 日
Hello,
In following program, i am trying to 'use break to get out of for loop' after checking my condition in if loop. i am unsure that whether it is right.please help.
Thanks
for x= 1:n
if start(S,x)>0
nextrow=x;
break
end
end

採用された回答

the cyclist
the cyclist 2014 年 9 月 20 日
Looks right to me. It is pretty similar to the example in the documentation page for the break command.

その他の回答 (0 件)

カテゴリ

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