%Reads ADCP data from CMO.  

clear all, close all 

j=1;tit='(CMO data)';xt='Time (in h)'; yt='Depth (in m)'; 

k=menu('ADCP Data','u','v','w','error','beams cor.','echo Int.');

if k==1,     tit=['u in cm/s ' tit];  
elseif k==2, tit=['v in cm/s ' tit]; 
elseif k==3, tit=['w in cm/s ' tit]; 
elseif k==4, tit=['error in cm/s ' tit];
elseif k==5, fprintf('Option not yet avaliable\n'),break 
elseif k==6, fprintf('Option not yet avaliable\n'),break 
else 
end 
 
fprintf('Opening data file..\n')
fid=fopen('adcp.data');
d1=fgets(fid);     
date(j,:)=[d1(14:24) ' at ' d1(26:37)];
fprintf('Date: %s\n',date(j,:))
Md=fscanf(fid,'%f',[17,inf])';
cdz(:,j)=Md(1:26,1);Mdreq(:,j)=Md(1:26,k+1);d1=fgets(fid);
for j=2:678
date(j,:)=[d1(13:23) ' at ' d1(25:36)]; 
fprintf('Date: %s\n',date(j,:))
Md=fscanf(fid,'%f',[17,inf])';
cdz(:,j)=Md(1:26,1);Mdreq(:,j)=Md(1:26,k+1);d1=fgets(fid);
while(d1(1)~='#')&(j<678)   
d1=fgets(fid);
end % while(...
end % for j=2... 
fclose(fid);  
 
%Ploting data: 
ti=0;tf=4*24+16+4/6+1/6; 
[m n]=size(Mdreq);cz=cdz(1:26,1);cnh=linspace(ti,tf,n)';
%mesh(cnh,cz,Mdreq),colormap('mastcolors'),shading interp,view(0,-90),colorbar
%Modified 03/11/97 by TORDAR 
pcolor( cnh , cz , Mdreq ) , shading interp, colormap( 'jet' ), view( 0, -90 ) 
colorbar 
%End of Modification 
xlabel(xt),ylabel(yt),title(tit) 
