Stop Excuting some lines

I have a while loop which goes throw some commands. I want the while loop to execute some of the commands only once while the others should be executed infinitely. I cannot remove these statement outside the loop as they are important in there location. So, is there a way to jump over them after the first execution without disturbing the loop.

 采纳的回答

flag = 1;
while <condition>
<commands to be always executed>
if flag
<commands to be executed only on first iteration>
end
<commands to be always executed>
if flag
<commands to be executed only on first iteration>
end
< ... >
flag = 0;
end

更多回答(0 个)

类别

帮助中心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!

Translated by