Rank: 13534 based on downloads (last 30 days) and 0 files submitted
photo

Andreas Köhler

E-mail
Company/University
Fraunhofer IIS/EAS
Lat/Long
51.151787, 10.415039

Personal Profile:

Professional Interests:
model order reduction / large scale dynamical systems

 

Watch this Author's files

 

Comments and Ratings by Andreas
Updated File Comments Rating
06 Jan 2009 Restore previous working directory on MATLAB Startup This simple program will restore the last working directory on resuming MATLAB Author: Vihang Patil

I made the following modification to finish.m such that my startup.m - which already contains important data - is not overwritten:

%%%%%%% finish.m %%%%%%
str = pwd;%store present working directory in the variable str

% figure out where to put restorewd script
pathstr=userpath;
if(isempty(pathstr))
  pathstr=[matlabroot filesep 'work'];
else
  pathstr=pathstr(1:find(pathstr==pathsep)-1);
end

fid = fopen(fullfile(pathstr,'restorewd.m'),'wt');%open file for writing
fprintf(fid,'answer = questdlg(''Do you want to continue working in the previous working directory'',''Restore Last Working Directory'',''Yes'',''No'',''Default'');\n');%write this and the following 3 lines into restorewd.m
fprintf(fid,'cd(''%s'');\n',str);
fprintf(fid,'end');
fclose(fid);%close file
%fprintf(fid,'end');
fclose(fid);%close file

Now, create or append to your existing startup.m:

if exist('restorewd')==2
  restorewd
end

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com