Call MATLAB "finish" (aka on exit) code directly

Alec Jacobson

October 02, 2012

weblog/

I have my matlab finish script set up so that it saves the current workspace and preserves the entire history. This is really useful when I restart matlab. Unfortunately it's only called when I exit matlab in a normal way. If matlab crashes or hangs (and then I have to kill it) then the finish script isn't called and I don't reap the benefits. Until now I didn't realize the obvious thing to do is to simply issue:
finish
before executing some crashy code.

Comments

October 03, 2012, Colin
I love this - it's like writing a will, or a suicide note. "If I don't make it out of this alive, here's everything I know..."