Loren on the Art of MATLAB

Turn ideas into MATLAB

Pausing for a Favorite Feature of R2016a 11

Posted by Loren Shure,

You may end up hearing this from many of the different bloggers at MathWorks. Steve and Stuart did! And now for my turn.

Contents

Have you ever desparately wished that you could find out what your calculation was up to, but, since it had been running a long time already, you didn't want to interrupt it, especially in case it was close? I have often wanted this. And now, on the Editor portion of the toolstrip, you can do this.

Example Code

Just to show you what the different states looked like, I have created a horrible piece of code to run.

type forever
function a = forever
while 1
    a = 1+1;
end
end

Before You Start

As you can see, it would never stop. Before I run it, here's what you see with the editor in focus.

Once the Code is Running

When the code is executing, you see this, again with the editor still in focus.

You are given the opportunity to pause the running code. MATLAB will pop you into the debugger where you can do the usual sleuthing around. And then...

Continue Executing the Code

Once you've done what you wanted in the debugger, you can then press Continue or Quit Debugging.

And go happily (I hope) along with your work.

Useful?

Do you find this new capability useful? We'd love to hear if it helps you out here.


Get the MATLAB code

Published with MATLAB® R2016a

7 views (last 30 days)  | |

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.