0001 function varargout = load_bl(cruiseid)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 cruise_dir=cruiseid;
0027 bl_dir=fullfile(cruise_dir,filesep,'raw_data');
0028 if exist(bl_dir)==0
0029 disp('Folder structure nonexistent')
0030 disp('Run create_cruise_dir')
0031 return
0032 end
0033 sd=['cd ',bl_dir];
0034 eval(sd)
0035 lc_bl = dir('*.bl');
0036 uc_bl = dir('*.BL');
0037
0038 if size(lc_bl)==size(uc_bl)
0039 bl_names = uc_bl;
0040 else
0041 if ~isempty(lc_bl) & ~isempty(uc_bl)
0042 error(['The *.bl files in ', bl_dir,' are named in both upper and lower case. Pick one and rename before running ',mfilename]);
0043 elseif isempty(lc_bl) & ~isempty(uc_bl)
0044 bl_names = uc_bl;
0045 elseif ~isempty(lc_bl) & isempty(uc_bl)
0046 bl_names = lc_bl;
0047 else
0048 error(['No *.bl files were found in ', bottle_dir]);
0049 end
0050 end
0051 for i=1:length(bl_names)
0052 bl(i)=bl2mat(bl_names(i).name);
0053 end
0054 cd ..
0055 fname=[cruise_dir,'_db.mat'];
0056 if exist(fname)==2
0057 savefile=['save ',fname,' bl -append'];
0058 eval(savefile);
0059 else
0060 savefile=['save ',fname,' bl -mat'];
0061 eval(savefile);
0062 end
0063 if nargout==0
0064 return
0065 else
0066 varargout{1}=bl;
0067 return
0068 end