How to make a function/script start over

39 次查看(过去 30 天)
Hello,
How can I make a script/function start over (as if nothing had happened) if certain criteria are not met ?
Thank you, have a nice day !

采纳的回答

Walter Roberson
Walter Roberson 2012-5-9
You cannot do that in MATLAB. You can, however, code a "while" loop that your code breaks out of if it is satisfied that everything is okay.
  3 个评论
laurie
laurie 2012-5-9
sorry i just did that and now my function is dreadfully slow ? is this to be expected ?

请先登录,再进行评论。

更多回答(1 个)

Daniel Shub
Daniel Shub 2012-5-9
Assuming you have a logical vector x of whether or not your criteria were meet
if ~all(x)
!matlab -r myscript.m &
exit
end

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by