How to end the running of a script in a subfunction?

I use matlab 2014b where the script and function are in different m files. Is it possible to end the running of the script in a function?

 Risposta accettata

error('Rage quitting!')

7 Commenti

This is the best way I have seen so far, although I don't want to see the error message.
if the script cooperates it can use try/catch .
However if the script were cooperating then just return a value from the function and have the script detect it and take appropriate action .
In fact, i just want to end the program when the function detects something. And no more running is needed. So try/catch is not what i want. But thanks for your supplement.
quit() can be called from within a program if you want to exit MATLAB completely.
that's totally the end of program...What I mean is to end the code not the matlab. Sorry for my unclear expression.
Then, NO, you cannot do that without seeing the error message -- not unless the program cooperates to try/catch to detect the quit and stop itself nicely.

Accedi per commentare.

Più risposte (1)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by