Existing node test
R = isnode(
isnode is a tree-management
R = isnode( returns
1's for nodes
N, which exist in the tree
and 0's for others.
N can be a column vector containing
the indices of nodes or a matrix, that contains the depths and positions
In the last case,
N(i,1) is the depth of
i-th node and
the position of the
The nodes are numbered from left to right and from top to bottom. The root index is 0.
% Create initial tree. ord = 2; t = ntree(ord,3); % binary tree of depth 3. t = nodejoin(t,5); t = nodejoin(t,4); plot(t)
% Change Node Label from Depth_Position to Index % (see the plot function).
% Check node index. isnode(t,[1;3;25]) ans = 1 1 0 % Check node Depth_Position. isnode(t,[1 0;3 1;4 5]) ans = 1 1 0