|
Contents | Previous | Next | Subchapters |
| Syntax |
y = sort(x) |
y = sort(x, d) | |
[y, idx] = sort(x) | |
[y, idx] = sort(x, d) | |
| See Also | sort , reverse |
d = 1 case).
If d is not present
and the row dimension of x is equal to one,
the row vector x is sorted (same as d = 2 case).
d = 1 case,
y = x
i,j idx(i,j) , j
In the d = 2 case,
y = x
i,j i, idx(i,j)
x = [ 3 2 1 0 ]
[y, idx] = sort(x)
y
O-Matrix will reply
[ 0 1 2 3 ]
If you continue by entering
idx
O-Matrix will reply
[ 4 3 2 1 ]