Ctdstrip E.m

From Pnb
Revision as of 14:15, 5 August 2010 by 128.111.101.185 (talk) (Created page with '<pre> function ctdstrip_E(pb,file) %ctdstrip_E %created by Erik Stassinos 2/10/10 %m function to strip first and third columns from ctd file and write them %to XyymmddD.ASC.stri…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
function  ctdstrip_E(pb,file)
%ctdstrip_E
%created by Erik Stassinos 2/10/10
%m function to strip first and third columns from ctd file and write them
%to XyymmddD.ASC.strip
%can run from processing dir.
%file is just file name without extension
%this function also makes the "list_ctd" file in the processing directory

%cd .. for when in proc dir.


%cd(pb) %need to change
here = pwd;

cd ..;
cd('CTD');
cd(pb);
cd('for_ac9');
copyfile(file,here);
pattern = fullfile(pwd,'*.asc');%assumes lower case .asc format
list = dir(pattern);
if isempty(list)
    disp('cannot find any .asc files here:')
    pwd
    return
end
for p = 1:size(list);
    list_ctd(p,:) = list(p).name;
end;

id = load(file,'.ASC');
x = id(:,1);
y = id(:,3);
columns(:,1) = x;
columns(:,2) = y;

%cd ..
cd ../../..
cd('processing'); %sends it back to processing dir

dlmwrite(strcat(file,'.strip'),columns,'delimiter',' ','precision',6);
dlmwrite('list_ctd',list_ctd,'');
%cd ..%/..

sprintf('done with ctdstrip_E')

end

ctdstrip_E