Ctrl-C in Matlab R2023b not working well
14 ビュー (過去 30 日間)
古いコメントを表示
When running Matlab in Window the keyboard combination Ctrl-C has previously worked well to abort execution of a running matlab program/script/function, and to return to the command window.
In Matlab R2023b this does not work well in several cases. Some specific cases include
- Iterating over multipel matlab.unittest.TestCase tests.
- Iterating in loops calling linprog() solvers.
Overall it seems that in loops and similar iterations Ctrl-C does not work well to abort the current execution.
Question: Is the how it is supposed to be now? Is there something that can be configured to make it work better as before?
Version R2022b does not have this issue. I don't know about R2023a.
0 件のコメント
回答 (1 件)
Vandit
2024 年 3 月 22 日
Hello Jim,
As mentioned in the MATLAB documentation Stop Execution - MATLAB & Simulink (mathworks.com), Ctrl+C might not always effectively stop execution for scripts or functions that run for an extended duration or that call built-ins or MEX-files. This is due to the potential risk of leaving MATLAB in an inconsistent state or not properly releasing native resources, like memory, which are shared with MEX files within the same memory space as MATLAB.
To mitigate this issue and enhance the interruptibility of your MATLAB scripts or functions, it is recommended to incorporate a "drawnow", "pause", or "getframe" function within your file, especially if it contains large loops. These functions can provide MATLAB with the opportunity to process the interrupt request more effectively.
To know more about "drawnow", "pause" and "getframe" functions, please refer to the links given below:
Hope this helps.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!