Force matlab to quit while stuck in an infinite loop?
189 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Thomas
2012-6-26
try ctrl + c
3 个评论
Thomas
2012-6-26
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 个)
Anver Hisham
2016-9-13
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!