function [P, T, S, C, V1]=rd_SB19(fnam)
%
%  Program to read DH-4 SBE19plus 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]);
      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:7])=junk([1:7]);
      dat(i,:)=dat1;
      i=i+1;
      clear junk
end
P=dat(:,3);
T=dat(:,1);
S=dat(:,4);
C=dat(:,2);
V1=dat(:,5);

fclose(fid);
