% rdWETLabs.m clear; close all; clc; tic folder='/Volumes/dav/CE01ISSP/R00001/extract'; save_dir = '/Users/michaesm/Documents/CE01ISSP/R00002/data'; cd(folder); % ACS = ac-s instrument % DBG = BAT battery, PDBG profiler debug % PPB = ADCP VELPT, CTD, OCR SPKIR, OPT DOSTA, PARS, TRIP FLORT. % SNA = SUNA nitrate insturment % WC = winch controller. HMR depth heading pitch roll, SBE pressure & velocity % WDBG winch debug, WM winch motor data len=1e3; nodepth=1; % depth didn't transfer to file disp('ac-s files are raw files, which need WL software for interpreting'); ctd=[]; vel=[]; opt=[]; par=[]; eco=[]; ocr=[]; suna=[]; files=ls; for i=1:size(files,1) if ~isempty(strfind(files(i,:),'CTD')) % CTD profile fid=fopen(files(i,1:26)); for j=1:7; f=fgetl(fid); end cnt=0; data=ones(len,5)*NaN; while f~=-1 cnt=cnt+1; if length(f)>15 data(cnt,1)=eval(['[',f(1:15),']']); tmp=eval(['[',f(17:end),']']); data(cnt,2:5)=tmp; end f=fgetl(fid); end if cnt15 if not(isempty(strfind(f,'?%'))) % ?% shows up mostly in the first line tmp=strfind(f,'?%'); f=[f(1:(tmp-1)),f((tmp+2):end)]; end if not(isempty(strfind(f,'%'))) tmp=strfind(f,'%'); f=[f(1:(tmp-1)),f((tmp+1):end)]; end if not(isempty(strfind(f,'n'))) tmp=strfind(f,'n'); f=[f(1:(tmp-1)),f((tmp+2):end)]; end if not(isempty(strfind(f,'y'))) tmp=strfind(f,'y'); f=[f(1:(tmp-1)),f((tmp+2):end)]; end tmp=strfind(f,' '); if length(tmp)==12 cnt=cnt+1; try tmp=eval(['[',f,']']); data(cnt,:)=tmp; catch disp(f); end elseif length(tmp)==13 cnt=cnt+1; try tmp=eval(['[',f,']']); data(cnt,:)=tmp([1:5,7:end]); catch disp(f); end end end f=fgetl(fid); end if cnt10 cnt=cnt+1; data(cnt,1:2)=eval(['[',f(1:tmp(2)),']']); dex=strfind(f,'SLB'); f=f(dex:end); tmp=strfind(f,' '); data(cnt,3:4)=eval(['[',f(tmp(4):tmp(6)),']']); end end f=fgetl(fid); end if cnt>0 if cnt