function [time wl dat]=rd_bb9(fnam)
%
%  Program to read DH-4/WAP BB9 file
%
%  INPUTS
%    FNAM = file name to read in.
%
%  OUTPUTS
%    
%  	 time = timestmap from WAP
%
%    dat = analog data
%
%
%  Written by Emmanuel Boss, U of Maine, 2012.
%   

fid=fopen(fnam,'r')
%clear all
%fid=fopen('C:\Documents and Settings\Emmanuel Boss\Desktop\RIVET2012\day1\archive_24_T_ASCII.000','r')
%skip first line  
%   line=fgetl(fid);
i=1;
while(feof(fid)==0);
      junk=fscanf(fid,'%f',[1]);
      if isempty(junk);
          break
      end
      time(i)=junk;
      junk=fscanf(fid, '%s',[1]);
      junk=fscanf(fid,'%f',[3]);
      dat1=fscanf(fid,'%f',[18]);
      junk=fscanf(fid, '%s',[1]);
      dat(i,:)=dat1([2,4,6,8,10,12,14,16,18]);
      i=i+1;
end
wl=dat1([1,3,5,7,9,11,13,15,17]);
fclose(fid);