How can I interrupt MATLAB when it gets really really busy?

Nathan Fellman picture Nathan Fellman · Mar 8, 2010 · Viewed 84.2k times · Source

I'm running a long simulation in MATLAB that I've realized I need to stop and rerun. However, MATLAB is really into this calculation, and it's stopped responding. How can I interrupt this run without killing MATLAB?

(I realize this is a problem with many Windows programs, but it's really acute with MATLAB.)

Answer

AVB picture AVB · Mar 8, 2010

Go to the command window, and hit Ctrl-C a lot. From my experience, on a single-core machine you do not have a chance, unless you do lots of output. On a multi-core or multi-processor machine, you'll probably stop it eventually, but it takes time.

See also http://www.mathworks.com/support/solutions/en/data/1-188VX/index.html

Added: it is a good practice to (1) save a snapshot of your workspace before running anything really long and (2) within a very long calculation, write some of the variables to a file from time to time, so that you can resume the calculation if it was interrupted (by power failure, e.g.).