Force matlab to quit while stuck in an infinite loop?

I found some newsgroup postings from about 4 years ago and back then there was no way to terminate a script from running in a infinite FOR loop without using ctrl+alt+delete. Has that changed or is there still no way to accomplish that?

 Respuesta aceptada

Thomas
Thomas el 26 de Jun. de 2012

14 votos

try ctrl + c

5 comentarios

Thomas
Thomas el 26 de Jun. de 2012
when an loop is running ctrl + c (just ctrl and c ) will exit any loop.. You have to do this in the command window when the loop is running (i.e. you do not have the >> prompt and it shows 'busy' on the status bar-- which is usually the case when MATLAB is performing any operation.. )
Thomas
Thomas el 26 de Jun. de 2012
To stop execution of whatever is currently running, press Ctrl+C or Ctrl+Break. On Apple Macintosh platforms, you can also use Command+. (the Command key and the period key) to stop the program. For certain operations, stopping the program might generate errors in the Command Window.
For files that run a long time, or that call built-ins or MEX-files that run a long time, Ctrl+C does not always effectively stop execution. Typically, this happens on Microsoft Windows platforms rather than UNIX[1] platforms. If you experience this problem, help MATLAB break execution by including a drawnow, pause, or getframe function in your file, for example, within a large loop. Note that Ctrl+C might be less responsive if you start MATLAB with the -nodesktop option.
Thomas
Thomas el 26 de Jun. de 2012
Another helpful link
http://www.mathworks.com/support/solutions/en/data/1-188VX/
Ognjen Jova
Ognjen Jova el 13 de En. de 2020
Movida: Walter Roberson el 8 de Nov. de 2024
Thomas you are a god,tnx alot man
Thanks man, appreciate alot

Iniciar sesión para comentar.

Más respuestas (1)

Anver Hisham
Anver Hisham el 13 de Sept. de 2016
You can use the below function to specify the maximum execution time-limit while running a program,
https://se.mathworks.com/matlabcentral/fileexchange/59120-evalwithtimer

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Jun. de 2012

Comentada:

el 25 de Oct. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by