Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Sort input elements by value

**Library:**DSP System Toolbox / Statistics

The Sort block ranks the values of the input
elements along each channel (column) in an `Ascending`

or
a `Descending`

order, based on the **Sort
order** you specify. Complex inputs are sorted by their magnitude,
which is the sum of the squares of the real and imaginary components
of the input. You can choose the **Sort algorithm** to
be either `Quick sort`

or ```
Insertion
sort
```

. The quick sort algorithm uses a recursive sort
method and is faster at sorting more than 32 elements. The insertion
sort algorithm uses a nonrecursive method and is faster at sorting
fewer than 32 elements. When you generate code, to avoid recursive
function calls, use the insertion sort algorithm.

The **Mode** parameter specifies the block's
mode of operation, which you can set to `Value`

, `Index`

,
or `Value and Index`

.

Was this topic helpful?