source: trunk/src/@xmltree/get.m @ 723

Last change on this file since 723 was 723, checked in by sommeria, 10 years ago

xmltree and toolbox_calib added to svn

File size: 1.1 KB
Line 
1function value = get(tree,uid,parameter)
2% XMLTREE/GET Get Method (get object properties)
3% FORMAT value = get(tree,uid,parameter)
4%
5% tree      - XMLTree object
6% uid       - array of uid's
7% parameter - property name
8% value     - property value
9%_______________________________________________________________________
10%
11% Get object properties of a tree given their UIDs.
12%_______________________________________________________________________
13% @(#)get.m                   Guillaume Flandin                02/03/27
14
15error(nargchk(2,3,nargin));
16
17value = cell(size(uid));
18uid = uid(:);
19if nargin==2
20        for i=1:length(uid)
21                if uid(i)<1 | uid(i)>length(tree.tree)
22                        error('[XMLTree] Invalid UID.');
23                end
24                % According to the type of the node, return only some parameters
25                % Need changes...
26                value{i} = tree.tree{uid(i)};
27        end
28else
29        for i=1:length(uid)
30                try,
31                        value{i} = subsref(tree.tree{uid(i)}, struct('type','.','subs',parameter));
32                catch,
33                        error(sprintf('[XMLTree] Parameter %s not found.',parameter));
34                end
35        end
36end
37if length(value)==1
38        value = value{1};
39end 
Note: See TracBrowser for help on using the repository browser.