BTL2MAT Reads the SeaBird ASCII .BL file format Usage: [bl_struct]=bl2mat(bl_file); Input: bl_file = name of .BL file (e.g. 'cast002.bl') Output:bl_struct with fields: station = station number niskinnumber = niskin bottle number fireorder = fire order CALLER: user DEPENDENCIES: AUTHOR: 18 Aug 2004 Carlos Fonseca (Carlos.Fonseca@noaa.gov) based on cnv2mat by Rich Signell. 4-8-98 Rich Signell (rsignell@usgs.gov) incorporates ideas from code by Derek Fong & Peter Brickley
0001 function [bl_struct]=bl2mat(bl_file); 0002 % BTL2MAT Reads the SeaBird ASCII .BL file format 0003 % 0004 % Usage: [bl_struct]=bl2mat(bl_file); 0005 % 0006 % Input: bl_file = name of .BL file (e.g. 'cast002.bl') 0007 % 0008 % Output:bl_struct with fields: 0009 % station = station number 0010 % niskinnumber = niskin bottle number 0011 % fireorder = fire order 0012 % 0013 % CALLER: user 0014 % 0015 % DEPENDENCIES: 0016 % 0017 % AUTHOR: 18 Aug 2004 Carlos Fonseca (Carlos.Fonseca@noaa.gov) 0018 % based on cnv2mat by Rich Signell. 0019 % 4-8-98 Rich Signell (rsignell@usgs.gov) 0020 % incorporates ideas from code by Derek Fong & Peter Brickley 0021 % 0022 0023 % Open the .bl file as read-only text 0024 % 0025 fid=fopen(bl_file,'rt'); 0026 if fid < 0 0027 disp(['WARNING: bl2mat could not open ',bl_file]); 0028 bl=[]; 0029 return 0030 end 0031 count=1; 0032 while ~feof(fid) 0033 str=fgetl(fid); 0034 if (strncmp(str,'C:',2)) 0035 is=findstr(str,'.'); 0036 isub=is-3:1:is; 0037 sta=sscanf(str(isub),'%d',3); 0038 elseif(strncmp(str,'RESET',5)) 0039 else 0040 is=findstr(str,','); 0041 isub=1:is(1)-1; 0042 fire(count,1)=sscanf(str(isub),'%d',3); 0043 isub=is(1)+1:is(2)-1; 0044 niskin(count,1)=sscanf(str(isub),'%d',3); 0045 count=count+1; 0046 end 0047 end 0048 bl_struct.station = sta; 0049 bl_struct.niskinnumber = niskin; 0050 bl_struct.fireorder = fire; 0051 return;