Changeset 686 for trunk


Ignore:
Timestamp:
Sep 19, 2013, 11:07:39 AM (11 years ago)
Author:
sommeria
Message:

further cleaning

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r684 r686  
    922922    drawnow
    923923    [XmlDataRead,warntext]=imadoc2struct(XmlFileName);
    924     if ~isempty(warntext)
    925         msgbox_uvmat('WARNING',warntext)
    926     end
    927924    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)   
    930926            if isfield(XmlDataRead,'TimeUnit')&& ~isempty(XmlDataRead.TimeUnit)
    931927                TimeUnit=XmlDataRead.TimeUnit;
     
    10501046if ~isempty(TimeUnit)
    10511047    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'];
    10531049    else
    10541050        UvData.TimeUnit=TimeUnit;
     
    10591055
    10601056%display warning message
    1061 if ~isequal(warntext,'')
     1057if ~isempty(warntext)
    10621058    msgbox_uvmat('WARNING',warntext);
    10631059end
  • trunk/src/xml2struct.m

    r685 r686  
    11% 'xml2struct': read an xml file as a Matlab structure, converts numeric character strings into numbers
    22%-----------------------------------------------------------------------
    3 % function s=xml2struct(filename)
     3% function [s,RootTag,errormsg]=xml2struct(filename,varargin)
    44%
    55% OUTPUT:
    66% 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
    79%
    810% INPUT:
    911% 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)
    1113
    12 function [s,Heading,errormsg]=xml2struct(filename,varargin)
     14function [s,RootTag,errormsg]=xml2struct(filename,varargin)
    1315s=[];
    14 Heading='';
     16RootTag='';
    1517errormsg='';
    1618try
    17 t=xmltree(filename);
     19    t=xmltree(filename);
    1820catch ME
    1921    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    if regexp(ME.message,'Undefined function')
     23        errormsg=[errormsg ': package xmltree not correctly installed, reload it from www.artefact.tk/software/matlab/xml'];
    2224    end
    2325    return
     
    2527iline=0;
    2628
    27 while isempty(Heading)
     29while isempty(RootTag)
    2830    iline=iline+1;
    2931    if strcmp(get(t,iline,'type'),'element')
    30         Heading=get(t,iline,'name');
     32        RootTag=get(t,iline,'name');
    3133    end
    3234end
    3335if nargin>1
    3436    for isub=1:nargin-1
    35         uid_sub=find(t,['/' Heading '/' varargin{isub}]);
     37        uid_sub=find(t,['/' RootTag '/' varargin{isub}]);
    3638        if isempty(uid_sub)
    3739            s.(varargin{isub})=[];
Note: See TracChangeset for help on using the changeset viewer.