Can I stop MATLAB when it's being busy?
577 次查看（过去 30 天）
If MATLAB runs a code, and takes not responding (displaying 'Busy' at the lower bar, next to start button), it removes the - >> sign from the command window, and I cant do anything but close it from the windows's task manager.
Is there a more elegant approach to that problem?
Sometimes even Ctrl-C does not work, when Matlab has no chance to evaluate the events. Therefore a DRAWNOW can be helpful in longer loops. Even in Mex files this can be done using mexCallMATLAB.
Kaveh Vejdani 2020-3-17
This is one of the major flaws of MATLAB. Although Ctrl+C "sometimes" works, the very fact that it doesn't "always" work makes it a major blunder on behalf of mathworks. The absurd yet only solution in these situations is to close down MATLAB and launch it again.
Fangjun Jiang 2011-6-30
I usually press ctrl+c or ctrl+d.
I don't know how I get the idea of pressing ctrl+d but I remembered it worked sometimes. Here is a reference to the MATLAB documentation.
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 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.