Stopping a paused script
조회 수: 29 (최근 30일)
이전 댓글 표시
I recently learned about the "pause" command from a friend. I was quite excited to try it out; being able to press (or hold!) a button to rapidly step through a for loop while plotting internal state at every step sounds like a killer workflow and a huge improvement over repeatedly pressing the "continue" button in the debugger (slow!) or adjusting the upper bound of the loop to look at successive snapshots of its internal state (slower!).
However, I frequently find myself in the position of wanting to break out of a paused loop before the loop is complete (it takes 10 minutes to perform all of the timesteps in my current script). Ctrl+C does not work and I cannot find any option in the GUI to halt execution of the script. I know that Ctrl+C cannot be expected to stop every possible computation because responding to Ctrl+C involves checking an event queue, but if there is one command I would expect to do this it would be "pause" and the fact that "pause" does not obey Ctrl+C completely kills its value proposition to my workflow.
Am I missing something? Is there an alternative way of stopping a script? Is this just a bug in the Mac OS X matlab front-end? Is there an alternative command similar to "pause" that does check its event queue and obey Ctrl+C?
Thanks in advance, Jon
Steps to reproduce:
- Type "pause" into the matlab command line (Mac OS X, MATLAB_R2014A)
- Note that Ctrl+C does not break the "pause" command
댓글 수: 2
Geoff Hayes
2014년 11월 20일
Jonathan - maybe I'm missing something, but pressing ctrl+c does break (for me) the pause. I am running R2014a on OS X 10.8.5. You do mean control and not command, correct?
Andrew Reibold
2014년 11월 20일
I typed pause(5) in my command line (2014a), and when I hit Ctrl+C it broke it early...
답변 (1개)
Sean de Wolski
2014년 11월 20일
I would suggest a different approach.
Rather than using a pause, put a break point on the line you want to pause on. Then you can press "Continue" to run the next iteration and when you're happy and want to cease further execution, press "Quit Debugging" to stop like you want. Then once, you're happy all around, rather than having to remove or comment the pause, you just disable the break point.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!