Stuart’s MATLAB Videos

Watch and Learn

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

New MATLAB Feature in Release 2016a: Pause Button 10

Posted by Stuart McGarrity,

In Release 2016a, you can now pause a running MATLAB program and enter debug mode. Here, I use this feature to stop a long running script to confirm it is working correctly.

Play the video in full screen mode for a better viewing experience.

10 CommentsOldest to Newest

Yaroslav replied on : 1 of 10
Hi Stuart, It's a great feature indeed. However, it seems that it requires the debugger to be turned on during the execution of a program. This may create an overhead and interfere with the JIT compiler. Therefore I wanted to inquire a bit about the internal implementations: a) Does the pause feature create an overhead (due to debugger)? How does it hurt the performance? b) How does it affect the JIT compiler? Does it mean that Matlab now interprets the code? Kind regards
Steve Eddins replied on : 2 of 10
Yaroslav—This feature does not adversely affect the performance of the MATLAB Execution Engine.
Stuart McGarrity replied on : 3 of 10
Yes, as Steve says, my colleague Ayon confirms there is no effect on performance. Specifically, a) The presence of the pause feature does not create any additional overhead. The MATLAB execution engine is designed to be able to pause and transfer control to the debugger without incurring overheads during normal execution. b) The pause feature does not affect the JIT compiler. "dbstop if error" and "dbstop if caught error" have no performance penalty during normal execution. The execution engine is designed to have no overhead in normal execution where there are no errors. A check is done for "dbstop if error" and "dbstop if caught error" conditions only when errors actually occur.
Naor replied on : 4 of 10
The pause button lives in the Editor tab of the tool strip. I want to pause a long running computation to check it is working correctly, but I ran the script from the Command Window and there is no Editor Window, and thus no Editor Tab. I can try to launch an Editor by, e.g., double clicking an m-file in the Current Folder window but there is a catch - the Editor will launch after MATLAB is done with the current job. Workaround? Future enhancement request? Thanks, -naor
Naor replied on : 6 of 10
Possibly include the button in the "code" section of the Home tab of the tool strip? Or even have a tool strip tab devoted to runtime options.
George replied on : 8 of 10
Does this feature works from command line? I want to pause a function but I'm running it from linux terminal.
Stuart McGarrity replied on : 9 of 10
Hi George, No, I do not believe there is a command line interface. Before I confirm, in your case, what would you like to do after you pause the function?
Stuart McGarrity replied on : 10 of 10
Hi Naor, Did you know that Ctrl-F5 pauses your program too, without the need for the editor to be open?