例如,我有
some calculations from some formulae
calculate r
if r<1
something
(the point where I want to discontinue and start the above calculations again)
else if r>tau
something
else if r==0
something
else
something
some calculations again after this
如果满足第一个条件(r&lt; 1),我怎样才能中断if / else并从顶部重新开始所有计算(r <1)...... ??
答案 0 :(得分:1)
你可以实现这个循环:
finished=false;
while ~finished
%default case, finish if case is done
finished=true;
if r<1
something
%start from begin in this case:
finished=false;
elseif r>tau
something
elseif r==0
something
else
something
end
end
答案 1 :(得分:0)
如果您的计算在一段时间内或for循环中完成,请使用CONTINUE或BREAK命令。