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.

 Réponse acceptée

bym
bym le 16 Août 2011

2 votes

Ctrl-c (control + c keys)

4 commentaires

AMM Nazmul Ahsan
AMM Nazmul Ahsan le 7 Jan 2018
It doesn't work.
Walter Roberson
Walter Roberson le 7 Jan 2018
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.
Hayden Mann
Hayden Mann le 13 Déc 2018
Make sure you click on the command window then press Ctrl + c.
Hernan Larriva
Hernan Larriva le 3 Avr 2023
thank very much!

Connectez-vous pour commenter.

Plus de réponses (1)

Paulo Silva
Paulo Silva le 16 Août 2011
%code
error('Mid script reached, this error message was made on purpose')
%code
Another alternative could be the use of the return function

2 commentaires

Shubha
Shubha le 8 Jan 2014
this is cool! :)
sangmin kim
sangmin kim le 22 Avr 2022
this is so cool!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by