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

Last change on this file since 1053 was 925, checked in by sommeria, 9 years ago

xmltree updated

File size: 1.2 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% Copyright (C) 2002-2011  http://www.artefact.tk/
14
15% Guillaume Flandin
16% $Id: get.m 4460 2011-09-05 14:52:16Z guillaume $
17
18
19%error(nargchk(2,3,nargin));
20
21value = cell(size(uid));
22uid = uid(:);
23if nargin==2
24    for i=1:length(uid)
25        if uid(i)<1 || uid(i)>length(tree.tree)
26            error('[XMLTree] Invalid UID.');
27        end
28        % According to the type of the node, return only some parameters
29        % Need changes...
30        value{i} = tree.tree{uid(i)};
31    end
32else
33    for i=1:length(uid)
34        try
35            value{i} = subsref(tree.tree{uid(i)}, struct('type','.','subs',parameter));
36        catch
37            error(sprintf('[XMLTree] Parameter %s not found.',parameter));
38        end
39    end
40end
41if length(value)==1
42    value = value{1};
43end 
Note: See TracBrowser for help on using the repository browser.