sort

Sort the input array

Syntax

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

Inputs

ArgumentTypeDescriptionUnit
xvectorarray to sortn/a
orderSCLDirection: positive value for ascending (default); negative value for descending-

Outputs / Return Value

Notes

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].

Review Status