diff --git a/struct2ANTS.m b/struct2ANTS.m --- a/struct2ANTS.m +++ b/struct2ANTS.m @@ -1,9 +1,9 @@ %====================================================================== % S T R U C T 2 A N T S . M % doc: Thu Oct 20 11:48:17 2005 -% dlm: Fri Jan 6 09:31:38 2012 +% dlm: Tue Feb 21 14:30:01 2012 % (c) 2005 A.M. Thurnherr -% uE-Info: 50 0 NIL 0 0 72 2 2 4 NIL ofnI +% uE-Info: 93 0 NIL 0 0 72 2 2 4 NIL ofnI %====================================================================== % % export Matlab structure to ANTS file @@ -32,6 +32,11 @@ % Jul 24, 2011: - BUG: PARAMS with % did not work % Jul 25, 2011: - commented out diagnostic message about skipped incompatible vectors % Dec 30, 2011: - workaround for Matlab R11b bug: /tmp/foo cannot be written, /../tmp/foo can +% Feb 20, 2012: - BUG: diagnostic messages did not show field prefices +% - BUG: skipped fields ended up in Layout after all +% Feb 21, 2012: - removed double quoting of % and $ +% - manually merged two versions +% - re-added diagnostic messages about skipped incompatible vectors function [] = struct2ANTS(struct,deps,ofn) @@ -66,21 +71,23 @@ if isstruct(f) [ldef,dta] = parseStruct(f,ldef,[fns '.'],dta,ofn); elseif ischar(f) - f = strrep(f,'%','%%'); % must quote %s - f = strrep(f,'$','\\\$'); % presumably also $s ldef = sprintf('%%%s%s="\\"%s\\"" %s',fpref,fns,f,ldef); elseif isnumeric(f) [r c] = size(f); if r+c == 2 ldef = sprintf('%%%s%s=%.15g %s',fpref,fns,f,ldef); else - ldef = sprintf('%s%s%s= ',ldef,fpref,fns); if isempty(dta), ndta = max(r,c); else, ndta = size(dta,1); end - if r==1 && length(f)==ndta, dta = [dta,f']; - elseif c==1 && length(f)==ndta, dta = [dta,f]; - else, 1; %disp(sprintf('%s: incompatible %d x %d array %s skipped',ofn,r,c,fns)); + if r==1 && length(f)==ndta + ldef = sprintf('%s%s%s= ',ldef,fpref,fns); + dta = [dta,f']; + elseif c==1 && length(f)==ndta + ldef = sprintf('%s%s%s= ',ldef,fpref,fns); + dta = [dta,f]; + else + disp(sprintf('%s: incompatible %d x %d array %s%s skipped',ofn,r,c,fpref,fns)); end end else