How to make a function/script start over

7 Ansichten (letzte 30 Tage)
laurie
laurie am 9 Mai 2012
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 !

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Mai 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 Kommentare
laurie
laurie am 9 Mai 2012
sorry i just did that and now my function is dreadfully slow ? is this to be expected ?
laurie
laurie am 9 Mai 2012
sorry it was a stupid mistake ^^

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Daniel Shub
Daniel Shub am 9 Mai 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

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by