MATLAB execution break problem

조회 수: 13 (최근 30일)
Belal Salama
Belal Salama 2015년 4월 14일
답변: Image Analyst 2015년 4월 14일
I have started running a script on MATLAB that takes days to finish. Usually, if I changed my mind and I don't want wait for it to finish and I get content with the intermediate results, I highlight the command window and press Ctrl-C to break the code.
Now, I have run MATLAB. But its desktop got kinda stuck in the background. When I try to restore the desktop from the toolbar, it does not restore. But I know from the task manager that the process is running and is consuming Memory and CPU performance. So, I am kinda stuck. I don't want to kill the process because I need the intermediate values in the workspace, and I can't open the desktop to break the code using ctrl-c.
Is there any solution? For example, is there any command that can be used in the command prompt to act as ctrl-c for MATLAB?
I am using MATLAB R2012b and Windows 8.

답변 (1개)

Image Analyst
Image Analyst 2015년 4월 14일
Use a GUI and have a checkbox that says "Finish Now". The users will be able to click it even though your process is running. At the end of your loop, check the checkbox state, and if it's checked, exit gracefully. This is much better than halting your code abruptly with the Control-c sledge hammer which leaves your variables and final execution line of code in an state of uncertainty.

카테고리

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