How to stop a script from executing

This is a basic question but I am wondering how you can halt a script from executing mid script.

 Risposta accettata

bym
bym il 16 Ago 2011

2 voti

Ctrl-c (control + c keys)

4 Commenti

It doesn't work.
It does generally work, but it does not take effect until the next time that MATLAB gets control. The symbolic computation engine is not under MATLAB's control for this purpose; and execution of heavy computation in the high performance math libraries is not under MATLAB's control for this purpose. Also, mex files and DLL are not under MATLAB's control for this purpose.
Make sure you click on the command window then press Ctrl + c.
thank very much!

Accedi per commentare.

Più risposte (1)

%code
error('Mid script reached, this error message was made on purpose')
%code
Another alternative could be the use of the return function

2 Commenti

this is cool! :)
this is so cool!!

Accedi per commentare.

Categorie

Scopri di più su Get Started with MATLAB in Centro assistenza e File Exchange

Tag

Richiesto:

il 16 Ago 2011

Commentato:

il 3 Apr 2023

Community Treasure Hunt

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

Start Hunting!

Translated by