function [time, T, C, P, S, sigma]=rd_SBE37(fnam)
%
%  Program to read DH-4/WAP SBE37 output file
%
%  INPUTS
%    FNAM = file name to read in.
%
%  OUTPUTS
%    
%  	
%    dat = analog data
%
%
%  Written by Emmanuel Boss, U of Maine, 2012.
%   

fid=fopen(fnam,'r')

%fid=fopen('C:\Documents and Settings\Emmanuel Boss\Desktop\RIVET2012\day1\archive_21_T_ASCII.000','r')

junk=0;
i=1;
while(feof(fid)==0)
      junk=fscanf(fid,'%f',[1]);
      if isempty(junk)
          break
      end
      char=fscanf(fid,'%c',[1]);
      junk(2)=fscanf(fid,'%f',[1]);
      char=fscanf(fid,'%c',[1]);
      junk(3)=fscanf(fid,'%f',[1]);
      char=fscanf(fid,'%c',[1]);
      junk(4)=fscanf(fid,'%f',[1]);
      char=fscanf(fid,'%c',[1]);
      junk(5)=fscanf(fid,'%f',[1]);
      char=fscanf(fid,'%c',[1]);
      junk(6)=fscanf(fid,'%f',[1]);
      char=fscanf(fid,'%c',[1]);
%      junk(7)=fscanf(fid,'%f',[1]);
      dat1([1:6])=junk([1:6]);
      dat(i,:)=dat1;
      i=i+1;
      clear junk
end
time=dat(:,1);
T=dat(:,2);
C=dat(:,3);
P=dat(:,4);
S=dat(:,5);
sigma=dat(:,6);

fclose(fid);
