sort

Parent Previous Next

sort

y = sort ( x,order[=1] )
y = x.sort ( order[=1] )

Sort the input array

arg

type

Description

Unit or Value scale

x

VCT

array to sort


order

SCL

Direction: positive value for ascending (default); negative value for descending


Outputs

  • y is the sorted array of x. If x is a matrix, each row is sorted.

Notes

  • Row-wise operation

Examples

  • Given y = [3 1 8 -2],
    y.sort → [-2 1 3 8].

    Given y =
    [3 1 8 -2
    3 5 2 2],
    y.sort →
    [-2 1 3 8
    2 2 3 5]
    y.sort(-1) →
    [8 3 1 -2
    5 3 2 2].

See Also

Created with the Personal Edition of HelpNDoc: Easily create Help documents