from Save Entire Command History by Jonathan Snell
Maintains a complete record of the command history (Matlab only maintains the last 20k worth ...

startup.m
if ispref('StartupDirectory','LastWorkingDirectory')
    lwd = getpref('StartupDirectory','LastWorkingDirectory');
    try
        cd(lwd)
    catch
        disp('Sorry, but I could not go to your last working directory:')
        disp(lwd)
    end;
end;
clear lwd;
format short g;

Contact us at files@mathworks.com