sort
Sort array elements by quick sort algorithm.
Syntax
B = sort(A)
B = sort(A, dim)
B = sort(..., direction)
B = sort(..., name, value)
[B, I] = sort(...)
Input argument
A - an nelson's variable (double, single, int8, int16, int32, int64, uint8, uint16, uint32, uint64, logical, char, string, cell).
dim - Dimension to operate along: positive integer scalar.
direction - Sorting direction: 'ascend' (default) or 'descend'.
name, value - name-value pair arguments.
Output argument
B - sorted array.
I - sort index.
Description
sort implements quick sort algorithm.
name-value pair arguments:
'MissingPlacement' - Placement of missing values: 'auto' (default), 'first', 'last'.
'ComparisonMethod' - Element comparison method: 'auto' (default), 'real', 'abs'.
Used function(s)
qsort (stl)
Bibliography
Quick sort algorithm from Bentley and McIlroy's "Engineering a Sort Function". Software - Practice and Experience
Examples
ComparisonMethod
MissingPlacement
See also
History
Version | Description |
---|---|
1.0.0 | initial version |
Author
Allan CORNET
Last updated