Robust Control Toolbox | ![]() ![]() |
Pack all information and data from several matrices, vectors and/or strings into a single `tree' variable. tree
implements the Robust Control Toolbox hierarchical tree data structure.
Syntax
Description
tree
creates a data structure T
, called a tree containing several variables and their names. This single variable contains all the data and dimension information from its branches b1
, b2
, b3
,, bn
along with a numerical index and a string name for each branch.
The input argument nm
is a string containing a list of names (separated by commas) to be assigned to the respective branches b1
,b2
,...,bn
"nm =
"
;.
The input arguments b1,b2,
,bn
(called the root branches of the tree) may be matrices, vectors, strings, or even trees themselves, thus enabling the creation of a hierarchical tree data structure within the MATLAB framework.
istree
checks whether a variable T
is a tree or not.
I=1
(true) if "T
" is a tree variable created by the function tree
; otherwise it returns I=0
(false). When the second input argument PATH
is present, the function istree
checks the existence of the branch specified by PATH
. For example,
returns "I = 1
", if both "T
" is a tree variable and "PATH
" is a valid path to a branch in the tree T
. Otherwise, it returns "I = 0
". If the optional output argument "B
" is present, then B
returns the value of the branch specified by PATH
, provided T
is a tree and PATH
is a valid path in T
.
Related functions include the following:
branch
: returns branches of a tree.branch
(T
,0
): returnsnm
, the list of branch names.T
(1
): returns the numberN
of the root branches.
Examples
A hierarchical tree structure shown inFigure 1-17 can be built as follows
tree1 = tree('a,b,c',a,b,c); tree3 = tree('w,x',w,x); tree2 = tree('tree3,y,z',tree3,y,z); bigtree = tree('tree1,tree2',tree1,tree2);
![]()
Figure 1-17: Example of Tree Structure.
To extract a variable from a tree, simply use the branch function:[tree1,tree2] = branch(bigtree); % getting variable w: w = branch(bigtree,'tree2/tree3/w'); % getting several variables: [w,b] = branch(bigtree,'tree2/tree3/w,tree1/b');
See Also
branch
, mksys
, graft
, istree
, issystem
, vrsys
![]() | tfm2ss | youla | ![]() |