- Timestamp:
- Sep 19, 2013, 10:37:44 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/imadoc2struct.m
r675 r685 35 35 %% case of xml files 36 36 if nargin ==1 37 [s,Heading ]=xml2struct(ImaDoc);% convert the whole xml file in a structure s37 [s,Heading,errormsg]=xml2struct(ImaDoc);% convert the whole xml file in a structure s 38 38 elseif nargin ==2 39 [s,Heading ]=xml2struct(ImaDoc,varargin{1});% convert the xml file in a structure s, keeping only the subtree defined in input39 [s,Heading,errormsg]=xml2struct(ImaDoc,varargin{1});% convert the xml file in a structure s, keeping only the subtree defined in input 40 40 else %TODO: deal with more than two subtrees? 41 [s,Heading]=xml2struct(ImaDoc,varargin{1},varargin{2});% convert the xml file in a structure s, keeping only the subtree defined in input 41 [s,Heading,errormsg]=xml2struct(ImaDoc,varargin{1},varargin{2});% convert the xml file in a structure s, keeping only the subtree defined in input 42 end 43 if ~isempty(errormsg) 44 errormsg=['imadoc2struct/xml2struct/' errormsg]; 45 return 42 46 end 43 47 if ~strcmp(Heading,'ImaDoc') 44 errormsg=' the input xml file is not ImaDoc';48 errormsg='imadoc2struct/the input xml file is not ImaDoc'; 45 49 return 46 50 end -
trunk/src/xml2struct.m
r675 r685 10 10 % varargin: optional list of strings to restrict the reading to a selection of subtrees, for instance 'GeometryCalib' (save time) 11 11 12 function [s,Heading]=xml2struct(filename,varargin) 12 function [s,Heading,errormsg]=xml2struct(filename,varargin) 13 s=[]; 14 Heading=''; 15 errormsg=''; 16 try 13 17 t=xmltree(filename); 18 catch ME 19 errormsg=ME.message; 20 if regexp(ME.message,'xml_findstr') 21 errormsg=[errormsg ': xmltree not correctly installed, download from www.artefact.tk/software/matlab/xml']; 22 end 23 return 24 end 14 25 iline=0; 15 Heading=''; 26 16 27 while isempty(Heading) 17 28 iline=iline+1;
Note: See TracChangeset
for help on using the changeset viewer.