% FILENAME : SV_CASE.M
% DONE BY : RENO CIPOLLA
% DATE : January 1995
% VERSION 01
% COPYRIGHT 1994-5 by T. Marlin and R. Cipolla
% This M-file saves the workspace to a user-input file
% ***************************************************************


while 1
 disp('')
 save_nm = input('Enter a filename (.mat) you wish to save this case under: ','s');
 if isempty(save_nm), break; end
 
 if exist(save_nm) == 0
   eval(['save ',save_nm]);
   disp('')
   disp([' SAVING TO.... ',num2str(save_nm),' '])
   pause(3)
   break
 else
   clc
   disp('')
   disp(' File already exists ')
   junk = input(' Do you wish to overwrite the file (y/n) :','s');
   if isempty (junk)
     junk = 'n'; 
     break
   end
   if junk == 'y'
     eval(['save ',save_nm]);  
     disp('')
     disp([' SAVING TO.... ',num2str(save_nm),' '])
     pause(3)
     break
   else
     disp('')
     disp(' Press any key to continue ... ')
     pause
     break
   end
 end
end
