How to make a function/script start over

33 ビュー (過去 30 日間)
laurie
laurie 2012 年 5 月 9 日
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 ?
laurie
laurie 2012 年 5 月 9 日
sorry it was a stupid mistake ^^

サインインしてコメントする。

その他の回答 (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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by