- Timestamp:
- Sep 19, 2013, 11:07:39 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r684 r686 922 922 drawnow 923 923 [XmlDataRead,warntext]=imadoc2struct(XmlFileName); 924 if ~isempty(warntext)925 msgbox_uvmat('WARNING',warntext)926 end927 924 if ~isempty(XmlDataRead) 928 ImaDoc_str=['view ' DocExt]; % DocExt= '.xml' or .civ (obsolete case) 929 %XmlData=XmlDataRead; 925 ImaDoc_str=['view ' DocExt]; % DocExt= '.xml' or .civ (obsolete case) 930 926 if isfield(XmlDataRead,'TimeUnit')&& ~isempty(XmlDataRead.TimeUnit) 931 927 TimeUnit=XmlDataRead.TimeUnit; … … 1050 1046 if ~isempty(TimeUnit) 1051 1047 if index==2 && isfield(UvData,'TimeUnit') && ~strcmp(UvData.TimeUnit,TimeUnit) 1052 msgbox_uvmat('WARNING',['time unit for second file series ' TimeUnit ' inconsistent with first series'])1048 warntext=['time unit for second file series ' TimeUnit ' inconsistent with first series']; 1053 1049 else 1054 1050 UvData.TimeUnit=TimeUnit; … … 1059 1055 1060 1056 %display warning message 1061 if ~ise qual(warntext,'')1057 if ~isempty(warntext) 1062 1058 msgbox_uvmat('WARNING',warntext); 1063 1059 end -
trunk/src/xml2struct.m
r685 r686 1 1 % 'xml2struct': read an xml file as a Matlab structure, converts numeric character strings into numbers 2 2 %----------------------------------------------------------------------- 3 % function s=xml2struct(filename)3 % function [s,RootTag,errormsg]=xml2struct(filename,varargin) 4 4 % 5 5 % OUTPUT: 6 6 % s= Matlab structure corresponding to the input xml file 7 % RootTag= name of the root tag in the xml file 8 % errormsg: errormessage, ='' by default 7 9 % 8 10 % INPUT: 9 11 % filename: name of the xml file 10 % varargin: optional list of strings to restrict the reading to a selection of subtrees, for instance 'GeometryCalib' (save time)12 % varargin: optional list of strings to restrict the reading to a selection of subtrees, for instance 'GeometryCalib' (save reading time) 11 13 12 function [s, Heading,errormsg]=xml2struct(filename,varargin)14 function [s,RootTag,errormsg]=xml2struct(filename,varargin) 13 15 s=[]; 14 Heading='';16 RootTag=''; 15 17 errormsg=''; 16 18 try 17 t=xmltree(filename);19 t=xmltree(filename); 18 20 catch ME 19 21 errormsg=ME.message; 20 if regexp(ME.message,' xml_findstr')21 errormsg=[errormsg ': xmltree not correctly installed, downloadfrom www.artefact.tk/software/matlab/xml'];22 if regexp(ME.message,'Undefined function') 23 errormsg=[errormsg ': package xmltree not correctly installed, reload it from www.artefact.tk/software/matlab/xml']; 22 24 end 23 25 return … … 25 27 iline=0; 26 28 27 while isempty( Heading)29 while isempty(RootTag) 28 30 iline=iline+1; 29 31 if strcmp(get(t,iline,'type'),'element') 30 Heading=get(t,iline,'name');32 RootTag=get(t,iline,'name'); 31 33 end 32 34 end 33 35 if nargin>1 34 36 for isub=1:nargin-1 35 uid_sub=find(t,['/' Heading '/' varargin{isub}]);37 uid_sub=find(t,['/' RootTag '/' varargin{isub}]); 36 38 if isempty(uid_sub) 37 39 s.(varargin{isub})=[];
Note: See TracChangeset
for help on using the changeset viewer.