MATLAB Answers


currently running a long function that I know has an error - Anyway to stop it now without losing all the variables?

Asked by Daniel
on 4 May 2013

I hastily started a very long function yesterday and unfortunately did not include any fail safes for saving my output in case there is an error. I see now that there is an error in my save command:

savename = 'myfile'; save (savename, 'var1', 'var2', 'var3'', 'var4', 'var5');

One of these variables is not an output argument in my function, and therefore will not exist when the above save command gets called. Is there anyway to suspend/stop this function and store the variables on the workspace before the inevitable error occurs? I'm guessing that I may be out of luck, but if there is a way to access the variables being processed in this function?

  1 Comment

AFAIK: No, you are out of luck


No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 4 May 2013

Like per said: Sorry, No.

There has been a number of times that I have wished that MATLAB had a way to interrupt into the debugger, as is common in many interpreted languages (and even in common Unix debuggers for C and other compiled languages.)


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!