Ctd2strip v2.m
Jump to navigation
Jump to search
%CTD2STRIP.M %function to add header information to the flat ctd files. %called by merge_ctdac9_v2 ----Modified by Erik S. %Modified to print ctd_head here instead of in merge_ctdac9_v2 6/7/2010 % '%%%' means modified 6/7/2010 function ctd2strip(pb,ctd_base) %%% pass in pb and eliminated 'head' return here = pwd; cd .. %%% cd CTD; %%% cd(pb); %%% cd hdr; %%% ctd_base; % % [s,name]=unix([ 'grep name ' ctd_base '.hdr']); % % if length(name) > 20 % % [s,name]=unix([ 'grep name ' ctd_base '.HDR']); [s,name]=unix([ 'grep name ' ctd_base '.hdr']); %%% if length(name) > 20 %%% [s,name]=unix([ 'grep name ' ctd_base '.HDR']) %%% true =1; %%% end %%% if true ==1 %%% [s,time]=unix([ 'grep Time ' ctd_base '.HDR']) %%%else [s,time]=unix([ 'grep Time ' ctd_base '.hdr']); %%%end % [s,time]=unix([ 'grep Time ' ctd_base '.HDR']) time=eval('[''# '' parse(time,-6)]'); file = strcat(ctd_base,'.hdr'); %%% file2 = strcat('ctd_head_n');%%% fid2 = fopen(file2,'w');%%% fid = fopen(file,'r');%%% pwd line =0;%%% while strncmp(line,'# name',6) ~=1%%% telllast = ftell(fid); line = fgets(fid);%%% end%%% count = 1;%%% whos; fprintf(fid2,'%s\n',time) fseek(fid,telllast,-1); while strncmp(line,'# span',6) ~=1%% line = char(fgets(fid));%%% if strncmp(line,'# span',6) ==1%%% break%%% end fprintf(fid2,'%s',line)%%% end pwd; fclose(fid); fclose(fid2); unix('mv ctd_head_n ../../../processing'); %%% cd(here); return