can i pause matlab excution while it is already running
171 views (last 30 days)
Nick Hilton on 12 Oct 2015
If you're on a UNIX platform, then there is an easy way to do this:
Simply run your script on the command line in a BASH shell like so:
matlab -nodesktop -nosplash -r "run_some_script(arg1, arg2, ...)"
Now that it is running, you can pause execution by pressing CTRL+Z, which pauses execution and returns you to the BASH prompt again. To continue execution, execute the 'fg' command to put the suspended job back into the foreground.
Another advantage to this approach, most graphical terminals provide an output buffer, and one can scroll and examine the output buffer without pausing the execution, and without new output causing the buffer to scroll the screen. So I can look at the buffer to tell where the execution is in a loop, for example, without pausing anything.
I hope this helps someone that finds this topic.
Image Analyst on 31 May 2016
With R2016a, there is now a Pause button on the tool ribbon that appears when your code runs:
Omer Moussaffi on 14 Dec 2014
Not without preparation. You could add the command 'keyboard' into the script at a specified place, and then it would give you back control. You then do your changes, and either call 'return' to resume or dbquit to stop the script.