A = nodeasc(
nodeasc is a tree-management
A = nodeasc( returns
the indices of all the ascendants of the node
be the index node or the depth and position of the node.
a column vector with
A(1) = index of node
A = nodeasc( is
a matrix, which contains the depths and positions of all ascendants.
the depth of the
i-th ascendant and
the position of the
The nodes are numbered from left to right and from top to bottom. The root index is 0.
% Create binary tree of depth 3. t = ntree(2,3); t = nodejoin(t,5); t = nodejoin(t,4); plot(t)
% Change Node Label from Depth_Position to Index % (see the plot function).
nodeasc(t,[2 2]) ans = 5 2 0 nodeasc(t,[2 2],'deppos') ans = 2 2 1 1 0 0