function [time, turb, Vcdom]=rd_analog(fnam)
%
%  Program to read DH-4/WAP analog file from RIVET exp.
%
%  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_29_T_ASCII.000','r')

junk=0;
i=1;
while(feof(fid)==0)
      junk=fscanf(fid,'%f',[4]);
      if isempty(junk)
          break
      end
       dat1([1:4])=junk([1:4]);
      dat(i,:)=dat1;
      i=i+1;
end
time=dat(:,1);
turb=dat(:,3);
Vcdom=dat(:,4);
fclose(fid);
