%print CTD cruise table
% have to use 'longtable' because the table spans more than one page.

fid=fopen('tables/abaco1209_CTD_Sum.txt','w');
fprintf(fid,'%s','\begin{longtable}{cccccc}');
fprintf(fid,'\n');    
fprintf(fid,'%s','\caption{Abaco Cruise -- CTD Cast Summary\label{long} }\\');
fprintf(fid,'\n');   
fprintf(fid,'%s','\hline');
fprintf(fid,'\n');    
fprintf(fid,'%s','Station & Date  & Time (GMT) & Latitude & Longitude & Depth \\');
fprintf(fid,'\n');    
fprintf(fid,'%s','\hline');
fprintf(fid,'\n'); 

  for ii=1:length(vertcat(cnv_load.station)),
    
    %date0=datenum(btl(ii).time(1),btl(ii).time(2),btl(ii).time(3),...
        %btl(ii).time(4),btl(ii).time(5),btl(ii).time(6));
    dat=datestr(btl(ii).time(1),'mm/dd/yyyy HH:MM:SS');
    date=dat(1:10);
    time=dat(12:16);
    
    fprintf(fid,'%3.0f\t%s%s\t%s%s\t%s%2.3f%s\t%s%2.3f%s\t%s%4.0f%s\n',btl(ii).station,'&',...
        date,'&',time,'&',btl(ii).Latitude(1),'N','&',...
        -1*btl(ii).Longitude(1),'W','&',btl(ii).PrDM(1),'\\');
    clear date0 dat date time
   end;
   
fprintf(fid,'\n');    
fprintf(fid,'%s','\hline');
fprintf(fid,'\n');          
fprintf(fid,'%s','\end{longtable}');

fclose(fid); 