Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of edl_readexpdefs_old
Home > sltoolbox > ExpDL > edl_readexpdefs_old.m

edl_readexpdefs_old

PURPOSE ^

EDL_READEXPDEFS Reads in experiment definition XML file

SYNOPSIS ^

function S = edl_readexpdefs(deffile)

DESCRIPTION ^

EDL_READEXPDEFS Reads in experiment definition XML file

 $ Syntax $
   - S = edl_readexpdefs(deffile)

 $ Arguments $
   - deffile:      the experiment definition XML file
   - S:            the struct of the set of experiment definitions
                   - name:    the name of the definition set
                   - envconf: the struct array of environment variables
                   - actions: the list of names of entries
                   - entry:   the struct array of entries
                       - name:  the name of action
                       - type:  the type of action
                         (scripting | experiment | reporting )
                       - func:  the matlab function to do the action
                       - params: the parameters

 $ Description $
   - S = edl_readexpdefs(deffile) reads in a set of experiment definitions
     from an XML property table file. 
     The document element should have following attribues:
       - 'name':       the name of the definition set
       - 'envconf':    the filename of environment configuration
     The entries should have following attributes
       - 'name':   the name of action (experiment)
       - 'type':   the type of action, the value can be
                   - 'scripting': generating a prop set controlling experiments
                   - 'experiment': performing experiments according to a
                                   property set
                   - 'reporting': generating a prop set as report 
       - 'func':   the matlab function to do the action
       - other attributes as parameters
   
 $ Remarks $
   - For experiment action, the params contains following fields:
       - 'expsch':  the property XML file of the experiment schemes
   - For scripting and reporting actions, the params contains user-defined
     fields.
     
 $ History $
   - Created by Dahua Lin, on Aug 10th, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • edl_readenvvars EDL_READENVVARS Reads in a file with environment variables
  • sladdpath SLADDPATH Adds dirpath to precede the filenames
  • xml_getattribs XML_GETATTRIBS Constructs an attribte struct from an XML element
This function is called by:

SOURCE CODE ^

0001 function S = edl_readexpdefs(deffile)
0002 %EDL_READEXPDEFS Reads in experiment definition XML file
0003 %
0004 % $ Syntax $
0005 %   - S = edl_readexpdefs(deffile)
0006 %
0007 % $ Arguments $
0008 %   - deffile:      the experiment definition XML file
0009 %   - S:            the struct of the set of experiment definitions
0010 %                   - name:    the name of the definition set
0011 %                   - envconf: the struct array of environment variables
0012 %                   - actions: the list of names of entries
0013 %                   - entry:   the struct array of entries
0014 %                       - name:  the name of action
0015 %                       - type:  the type of action
0016 %                         (scripting | experiment | reporting )
0017 %                       - func:  the matlab function to do the action
0018 %                       - params: the parameters
0019 %
0020 % $ Description $
0021 %   - S = edl_readexpdefs(deffile) reads in a set of experiment definitions
0022 %     from an XML property table file.
0023 %     The document element should have following attribues:
0024 %       - 'name':       the name of the definition set
0025 %       - 'envconf':    the filename of environment configuration
0026 %     The entries should have following attributes
0027 %       - 'name':   the name of action (experiment)
0028 %       - 'type':   the type of action, the value can be
0029 %                   - 'scripting': generating a prop set controlling experiments
0030 %                   - 'experiment': performing experiments according to a
0031 %                                   property set
0032 %                   - 'reporting': generating a prop set as report
0033 %       - 'func':   the matlab function to do the action
0034 %       - other attributes as parameters
0035 %
0036 % $ Remarks $
0037 %   - For experiment action, the params contains following fields:
0038 %       - 'expsch':  the property XML file of the experiment schemes
0039 %   - For scripting and reporting actions, the params contains user-defined
0040 %     fields.
0041 %
0042 % $ History $
0043 %   - Created by Dahua Lin, on Aug 10th, 2006
0044 %
0045 
0046 %% Read file
0047 
0048 xdoc = xmlread(deffile);
0049 docelem = xdoc.getDocumentElement;
0050 curdir = fileparts(deffile);
0051 
0052 %% Read header
0053 
0054 S = [];
0055 S.name = char(docelem.getAttribute('name'));
0056 
0057 envconf_fn = char(docelem.getAttribute('envconf'));
0058 if isempty(envconf_fn)
0059     S.envconf = [];
0060 else
0061     envconf_fn = sladdpath(envconf_fn, curdir);
0062     S.envconf = edl_readenvvars(envconf_fn);
0063 end
0064 
0065 %% Read Entries
0066 
0067 S.entry = [];
0068 S.actions = {};
0069 
0070 entries = docelem.getElementsByTagName('Entry');
0071 n = entries.getLength;
0072 
0073 if n == 0
0074     return;
0075 end
0076 
0077 S.actions = cell(n, 1);
0078 for i = 1 : n
0079     
0080     curentry = entries.item(i-1);
0081     
0082     S.entry(i).name = char(curentry.getAttribute('name'));
0083     S.entry(i).type = char(curentry.getAttribute('type'));
0084     if ~ismember(S.entry(i).type, {'scripting', 'experiment', 'reporting'})
0085         error('sltoolbox:parseerror', ...
0086             'Invalid experiment definition type %s', S.entry(i).type);
0087     end
0088     S.entry(i).func = char(curentry.getAttribute('func'));
0089     S.entry(i).params = xml_getattribs(curentry, {'name', 'type', 'func'});
0090     
0091     S.actions{i} = S.entry(i).name;
0092     
0093 end
0094 
0095 
0096 
0097 
0098 
0099 
0100 
0101 
0102

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com