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?
Matar Maoz

采纳的回答

Jan
Jan 2011-6-30
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.
  5 个评论
madhan ravi
madhan ravi 2020-7-9
In iOS even if I close and start the app sometimes it’s a never ending story. For example if there’s some code using input() if something other than numeric is given it stays forever unless I give in a proper value, wasted a lot of time figuring out , how to stop it.

请先登录,再进行评论。

更多回答(5 个)

Kaveh Vejdani
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.
  2 个评论
Walter Roberson
Walter Roberson 2020-3-17
A major cause, especially on Windows, that control-C can have no effect, is in the case where more RAM has been requested than is physically present, and the operating system is busy swapping to and from disk. I am not aware of any comoperating system that does a good job of interrupt handling in that situation; it seems to me that Windows is poor on this regard. This is an operating system matter, though, not a MATLAB matter.

请先登录,再进行评论。


Andrei Bobrov
Andrei Bobrov 2011-6-30
Ctrl+Break
  3 个评论
Yujia Zhai
Yujia Zhai 2019-6-1
编辑:Yujia Zhai 2019-6-1
Come on! Why dont you just talk to Matlab and indicate it to stop?

请先登录,再进行评论。


Fangjun Jiang
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.
Stopping Execution
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.
  2 个评论
niraj
niraj 2019-3-13
Thanks Fangjun Jiang, control+break definitly works, even in worst situation. My MATLAB was struck in a never ending plot loop, still it worked by pressing control+break.

请先登录,再进行评论。


Adrian Jacov
Adrian Jacov 2016-8-23
Excelente gracias,

Muhammad Usama Sharaf SAAFI
You should press ctrl+c in such scenarios.
MATLAB will stop all excecution.
  1 个评论
Walter Roberson
Walter Roberson 2020-3-17
control+c will not alway stop immediately. In fact, it can take a number of hours before it stops in some cases.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by