# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# allnodes

## Syntax

```N = allnodes(T) N = allnodes(T,'deppos') ```

## Description

`allnodes` is a tree management utility that returns one of two node descriptions: either indices, or depths and positions.

The nodes are numbered from left to right and from top to bottom. The root index is 0.

`N = allnodes(T)` returns the indices of all the nodes of the tree `T` in column vector `N`.

`N = allnodes(T,'deppos')` returns the depths and positions of all the nodes in matrix `N`.

`N(i,1)` is the depth and `N(i,2)` the position of the node `i`.

## Examples

collapse all

This example shows how to obtain the depth-position and linear indices of a wavelet packet tree.

Load the noisy Doppler signal and obtain the wavelet packet decomposition down to the level 4 using the `'db2'` wavelet.

```load noisdopp; T = wpdec(noisdopp,4,'db2'); ```

Obtain the depth-position indices.

```DepthPosition = allnodes(T,'deppos'); ```

Obtain the corresponding linear indices.

```LinearIndices = allnodes(T); ```

Display the correspondance in a table.

```table(DepthPosition,LinearIndices) ```
```ans = 31x2 table DepthPosition LinearIndices _____________ _____________ 0 0 0 1 0 1 1 1 2 2 0 3 2 1 4 2 2 5 2 3 6 3 0 7 3 1 8 3 2 9 3 3 10 3 4 11 3 5 12 3 6 13 3 7 14 4 0 15 4 1 16 4 2 17 4 3 18 4 4 19 4 5 20 4 6 21 4 7 22 4 8 23 4 9 24 4 10 25 4 11 26 4 12 27 4 13 28 4 14 29 4 15 30 ```