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

1 view (last 30 days)
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?

Answers (1)

Walter Roberson
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.)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!