No BSD License  

Highlights from
restore_editfiles

from restore_editfiles by Richard Los
Reloads *.m files if editor is closed.

restore_editfiles(usernamespec,matlabrev)
function restore_editfiles(usernamespec,matlabrev)
%RESTORE_EDITFILES reloads the .m files to the file editor if you accidentally close it, or when switching revs
%   if run w/ no arguments, reloads .m files that were open at the end of the last session
%
%   usernamespec    if you specify this, it will load the files previously edited by that user, 
%                   otherwise gets login ID of current user (Windows)
%   matlabrev       if you specify this, it'll open the files last edited in that version 
%                   (handy for switching from R13 to R14)
%
%   Matlab R13 & R14, Windows only ... if .ini/.xml file formats are similar in mac, just need to put in proper location
%
%   Note: not much error handling
%
%   Richard Los\
%   richo507@yahoo.com

if (nargin == 0) | isempty(usernamespec)
    usernamespec = upper(getenv('nwusername'));
    if isempty(usernamespec)
        usernamespec = upper(getenv('username'));
    end
end
if (nargin <= 1) | isempty(matlabrev)
    matlabrev = version;
end
    

if ~isempty(findstr(matlabrev,'R13'))
    ini_fid = fopen(['C:\Documents and Settings\' usernamespec '\Application Data\MathWorks\MATLAB\R13\MATLAB.ini']);
elseif ~isempty(findstr(matlabrev,'R14'))
    ini_fid = fopen(['C:\Documents and Settings\' usernamespec '\Application Data\MathWorks\MATLAB\R14\MATLABDesktop.xml']);
end
tstr = char(fread(ini_fid,'char'))';
fclose(ini_fid);

if ~isempty(findstr(matlabrev,'R13'))
    edfileheaderstr = ['com.mathworks.ide.editor.EditorViewContainer' char([13 10])];
    newlines = findstr(tstr,char([13 10]));
elseif ~isempty(findstr(matlabrev,'R14'))
    edfileheaderstr = ['EditorFileName="'];
    newlines = findstr(tstr,'"/>');
end
edfileheader = findstr(tstr,edfileheaderstr) + length(edfileheaderstr);
for n = 1:length(edfileheader)
    newline_index = newlines(min(find(newlines > edfileheader(n))));
    edit(tstr(edfileheader(n):(newline_index-1)))
end

Contact us at files@mathworks.com