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

fid=fopen(fnam,'r')

%fid=fopen('c:\data\CoBOP99\cobop990521_084025.dat','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]);
      dat1([1:4])=junk([1:4]);
      dat(i,:)=dat1;
      i=i+1;
      clear junk
end
P=dat(:,3);
T=dat(:,1);
S=dat(:,4);
C=dat(:,2);

fclose(fid);
