Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.)

like image 790
Nathan Fellman Avatar asked Mar 08 '10 20:03

Nathan Fellman


People also ask

How do I interrupt MATLAB when busy?

To stop execution of a MATLAB® command, press Ctrl+C or Ctrl+Break. On Apple Macintosh platforms, you also can use Command+.

How do I pause MATLAB while running?

Typing pause(inf) puts you into an infinite loop. To return to the MATLAB prompt, type Ctrl+C. Example: pause(3) pauses for 3 seconds. Example: pause(5/1000) pauses for 5 milliseconds.

Why MATLAB is busy?

When MATLAB opens with "Initializing" or "Busy" for an extended period of time, the MATLAB installation may be experiencing a licensing issue.


1 Answers

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.).

like image 81
AVB Avatar answered Oct 15 '22 11:10

AVB