MATLAB: How to save a list of open m-files

editorm-file

Is there a function that returns the list of files currently open in the editor?
I frequently work with 25+ m-files open. When quitting and restarting MATLAB, the open files are reopened as desired (preferences setting). However, in the rare case that MATLAB crashes, I have often restarted to find an empty editor. It is a pain to manually select and reopen each m-file. If there is a function for getting the list, I can run it in my finish.m script and save the results. That way I always have a way to reload open files.

Best Answer

I found a way. It's not pretty, but in case someone else might find this useful...
In my user folder (on OSX) there is .matlab/R2009a/MATLABDesktop.xml
There is a LOT of stuff in this file, but I found many entries of the form:
<ClientData EditorFileName="FULL PATH TO ONE OF MY OPEN M-FILES"/>
All my m-files are at /Volumes/data/adam/...
The following grep commands find the desired lines in the xml file and extract JUST the m-file paths:
grep 'EditorFileName' MATLABDesktop.xml | grep -o '\"/Volumes/.*\.m\"'
Copy/paste the list into a cell array and
edit(X{:})
The API referenced by Sean de seems like a much nicer option for those using newer releases.