Changeset 663 for trunk/src/xml2struct.m
- Timestamp:
- Jul 11, 2013, 6:45:32 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/xml2struct.m
r662 r663 46 46 out.(names{k})=convert_string(ss.(names{k})); 47 47 end 48 case 'char' 49 out=str2double(ss); 50 %if isempty(regexp(ss,'^(-*\d+\.*\d*\ *)+$'))% if the string does not contain a set of numbers (with possible sign and decimal) separated by blanks 51 if isnan(out) 52 sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables 53 if ~isempty(sep_ind) 54 sep_ind=[-2 sep_ind length(ss)+1]; 55 for icolumn=1:length(sep_ind)-1 56 out{1,icolumn}=ss(sep_ind(icolumn)+3:sep_ind(icolumn+1)-1); 48 case 'char' 49 out=ss; %reproduce the input string 50 if ~strcmp(ss,'image')% bug with Matlab str2num('image')-> child face 51 out=str2num(ss); 52 %if isempty(regexp(ss,'^(-*\d+\.*\d*\ *)+$'))% if the string does not contain a set of numbers (with possible sign and decimal) separated by blanks 53 if isempty(out) 54 sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables 55 if ~isempty(sep_ind) 56 sep_ind=[-2 sep_ind length(ss)+1]; 57 for icolumn=1:length(sep_ind)-1 58 out{1,icolumn}=ss(sep_ind(icolumn)+3:sep_ind(icolumn+1)-1); 59 end 60 else 61 out=ss; %reproduce the input string 57 62 end 58 else59 out=ss; %reproduce the input string60 63 end 61 64 end … … 64 67 check_numeric=zeros(size(ss)); 65 68 for ilist=1:numel(ss) 66 if ~ isempty(str2num(ss{ilist}))69 if ~strcmp(ss{ilist},'image') && ~isempty(str2num(ss{ilist})) 67 70 out{ilist,1}=str2num(ss{ilist}); 68 71 check_numeric(ilist)=1;
Note: See TracChangeset
for help on using the changeset viewer.