how to run a function again and again till a condition satisfies?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, i have a function which i want to run again and again till the condition is fulfilled.
please please help me....
0 件のコメント
採用された回答
Mischa Kim
2015 年 4 月 27 日
suchismita, see e.g.,
flag = false;
cnt = 0;
while ~flag
cnt = cnt + 1;
fprintf('Try no.: %d\n', cnt);
if (rand() < 0.25)
flag = true;
end
end
Your function would simply reside inside the loop.
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!