.
--- a/export_LADCP.m
+++ b/export_LADCP.m
@@ -1,9 +1,9 @@
%======================================================================
-% E X P O R T _ L A D C P
+% E X P O R T _ L A D C P . M
% doc: Tue Sep 16 12:04:42 2008
-% dlm: Tue Sep 16 12:18:32 2008
+% dlm: Fri Nov 13 13:16:26 2009
% (c) 2008 A.M. Thurnherr
-% uE-Info: 30 56 NIL 0 0 72 2 2 4 NIL ofnI
+% uE-Info: 33 30 NIL 0 0 72 2 2 4 NIL ofnI
%======================================================================
%
% Synopsis: export list of LADCP stations to ANTS
@@ -19,6 +19,7 @@
% HISTORY:
% Sep 16, 2008: - created
+% Nov 13, 2009: - adapted to new LDEO_LADCP2ANTS
function [] = export_LADCP(stns)
@@ -31,7 +32,7 @@
elseif isfield(p,'magdev') % IfM processed
IfM_LADCP2ANTS(dr,p,bn);
else % LDEO processed
- LDEO_LADCP2ANTS(dr,p,bn);
+ LDEO_LADCP2ANTS(dr,f,p,bn);
end
else
disp(sprintf('skipping station %d',s));
new file mode 100644
--- /dev/null
+++ b/loadANTS.m
@@ -0,0 +1,66 @@
+%======================================================================
+% L O A D A N T S . M
+% doc: Thu Jul 21 22:53:21 2011
+% dlm: Thu Jul 21 23:43:06 2011
+% (c) 2011 A.M. Thurnherr
+% uE-Info: 61 60 NIL 0 0 72 2 2 4 NIL ofnI
+%======================================================================
+
+% NOTES:
+% - very restrictive subset of ANTS standard:
+% = no empty lines
+% - no in-record comments
+
+% HISTORY:
+% Jul 21, 2011: - began working on it
+
+function dta_struct = loadANTS(file_name)
+
+fid = fopen(file_name); % open file
+if fid < 0
+ error(ferror(fid));
+end
+
+dta_struct = struct([]);
+
+l = fgetl(fid); % handle metadata
+while ischar(l) & regexp(l,'^#')
+ if regexp(l,'^#ANTS#ERROR#')
+ error(l);
+ elseif regexp(l,'^#ANTS#PARAMS#')
+ params = regexp(l,'(\w+){([^}]*)}','tokens');
+ for i=1:length(params)
+ if strcmp(params{i}{2},'')
+ dta_struct = rmfield(dta_struct,params{i}{1});
+ else
+ dta_struct = setfield(dta_struct,params{i}{1},params{i}{2});
+ end % if
+ end % for
+ elseif regexp(l,'^#ANTS#FIELDS#')
+ field = regexp(l,'{([^}]*)}','tokens');
+ end % elseif
+ l = fgetl(fid);
+end % while
+
+if ~ischar(l) % EOF
+ close(fid);
+ return
+end
+
+fmt = ''; % construct scanf format
+for i=1:length(field)
+ fmt = [fmt ' %f'];
+end
+
+rec1 = sscanf(l,fmt); % split first record
+dta = fscanf(fid,fmt); % read & split remaining records
+
+for i=1:length(field) % copy to structure
+ disp(field{i});
+ keyboard
+ dta_struct = setfield(dta_struct,field{i},[rec1(i); dta(:,i)]);
+end
+
+flose(fid);
+
+return