%MMP_read_ctd.m
%  a script to read a user-specified MMP ascii CTD file 
%  and make availabe in the work space the following variables:
% ccond, ctemp, cpres

directory=input(' Enter the name of the directory holding the data file: ','s');
prof_num=input('    And the profile number you want to read: ');

  cfile=['C',sprintf('%7.7i',prof_num)];


filename=[directory '/' cfile '.TXT'];

if(exist('cpres'));
clear ccond ctemp cpres;
end

if exist(filename,'file');
eval(['load ',filename]);
   ctd=eval(cfile);
   disp(['Loading CTD file:  ',filename]);

       csnum=[1:1:length(ctd)];
       ccond=ctd(:,1);
       ctemp=ctd(:,2); 
       cpres=ctd(:,3);
 

else

disp(['File not found or is unaccessible ']);
    disp(['CTD file in question:  ',filename]);

end


