substitute for do while loop

3 ビュー (過去 30 日間)
Terry McGinnis
Terry McGinnis 2015 年 6 月 23 日
コメント済み: Terry McGinnis 2015 年 6 月 23 日
I need to implement and exit controlled loop in matlab.Is there a efficient replacement to the 'do...while' that can be in matlab?Or do we need to use some other logic?
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2015 年 6 月 23 日
Why do you want to replace the while loop?

サインインしてコメントする。

採用された回答

Jan
Jan 2015 年 6 月 23 日
doLoop = true;
while doLoop
disp('in loop');
if rand < 0.01 % <- Your control to break the loop
doLoop = false;
end
end
  1 件のコメント
Terry McGinnis
Terry McGinnis 2015 年 6 月 23 日
thanks.I implemented something similar.

サインインしてコメントする。

その他の回答 (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