function [dat]=rd_analog(fnam,n)
%
%  Program to read DH-4 analog files with n columns
%
%  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')
%skip first 2 lines
for i=1:2   
   line=fgetl(fid);
end
i=1;
while(feof(fid)==0)
      junk=fscanf(fid,'%f',[n]); %n represnets the # of columns of data.
      if isempty(junk)
          break
      end
      dat1([1:n])=junk([1:n]);
      dat(i,:)=dat1;
      i=i+1;
end

fclose(fid);
