File Exchange Pick of the Week

Our best user submissions

Start MATLAB in Last Working Directory 4

Posted by Brett Shoelson,

Brett's Pick this week is "Startup MATLAB in Last Working Directory", by Michelle Hirsch.

Several years ago, Loren wrote a blog post encouraging people to share the contents (at least thematically) of their startup files. A lengthy and interesting discussion ensued--it's still worth a read. More recently (last week, in fact!), Sean guest-selected as a Pick-of-the-Week Kevin Bartlett's very useful submission that facilitates the saving of "projects"; I wanted to follow Sean's post with a lighter-weight approach to resuming one's previous coding activities in MATLAB.

When I close MATLAB in the middle of working on a project (or projects), I typically leave relevant editor documents open--whenever it's not inconvenient to do so. That way I can right-click on the tab for an open document and change, relatively painlessly, to its parent directory:

I haven't (yet) implemented Kevin's "projects" approach, but tonight, I changed my long-static startup.m file to incorporate Michelle's "Last Working Directory (LWD)" instructions. Michelle's file contains a small HTML document with instructions--and code snippets--detailing how to modify your startup and finish files to automatically resume working in the directory in which you were last working . It's trivially easy to implement, once you know how, and it saves me the "trouble" of having to manually click to resume my last session.

Also, I'm embarassed to say that, though I've used MATLAB (and 'startup') for nearly 20 years, I never even realized we have a 'finish' file to accompany startup.

As always, I welcome your thoughts and comments. Or leave feedback for Michelle here.


Get the MATLAB code

Published with MATLAB® R2013a

14 views (last 30 days)  | |

Comments

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