change the for loop
2 ビュー (過去 30 日間)
古いコメントを表示
How can i put the for loop 10 times forward when an if statement is true?
0 件のコメント
採用された回答
Walter Roberson
2012 年 5 月 31 日
If you are asking how you can skip 10 iterations of the for loop if an "if" statement is true, then the answer is that you cannot. You can, though, structure your loop like
num_to_skip = 0;
for K = 1 : 100
if num_to_skip > 0
num_to_skip = num_to_skip - 1;
continue
end
[...]
if YourCondition
num_to_skip = 10;
continue
end
[...]
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
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!