MATLAB Answers

How to make a function/script start over

116 views (last 30 days)
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 !

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 9 May 2012
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 Comments

laurie
laurie on 9 May 2012
oh nooo that's disappointing ^^ thank you :)
laurie
laurie on 9 May 2012
sorry i just did that and now my function is dreadfully slow ? is this to be expected ?
laurie
laurie on 9 May 2012
sorry it was a stupid mistake ^^

Sign in to comment.

More Answers (1)

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

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags