Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在matlab中,如何中断介于两者之间的ifelse条件并重新从顶部开始?_Matlab - Fatal编程技术网

在matlab中,如何中断介于两者之间的ifelse条件并重新从顶部开始?

在matlab中,如何中断介于两者之间的ifelse条件并重新从顶部开始?,matlab,Matlab,例如,我有 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 af

例如,我有

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
如果rtau
某物
如果r==0,则为else
某物
其他的
某物
之后再做一些计算

如果我的第一个条件得到满足,我如何停止if/else并从顶部重新开始所有计算(r如果您的计算是在一段时间内或for循环中完成的,请使用CONTINUE或BREAK命令。

您可以通过循环实现这一点:

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
finished=false;
当~完成时
%默认案例,案例完成后完成
完成=正确;
如果rtau
某物
elseif r==0
某物
其他的
某物
结束
结束

嗯,我有if和else if循环,matlab不允许继续或中断if/else??我能做什么?您好,有没有可能与您联系,我需要更多关于matlab的帮助?在这里询问有关stackoverflow的问题。