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.

 Akzeptierte Antwort

bym
bym am 16 Aug. 2011

2 Stimmen

Ctrl-c (control + c keys)

4 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Paulo Silva
Paulo Silva am 16 Aug. 2011

1 Stimme

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

2 Kommentare

Shubha
Shubha am 8 Jan. 2014
this is cool! :)
sangmin kim
sangmin kim am 22 Apr. 2022
this is so cool!!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 16 Aug. 2011

Kommentiert:

am 3 Apr. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by