x can be a numerical vector, matrix, or a list of numbers or strings.
- sort(x): sort in ascending order. Treat x as row vector when
it is a matrix.
- rowsort(x): sort each row in ascending order
- columnsort(x): sort each column in ascending order
- indexsort(x): return the index vector of the sorted copy of x
- rowindexsort(x): return the index matrix of the of x with each row sorted
- columnindexsort(x): return the index matrix of the of x with each column sorted
- reverse(x): reverse
- rowreverse(x): reverse each row
- columneverse(x): reverse each column
If one wishes to sort all the rows according to the value of a column, an index
sort can be done to that column, then the sorted index is applied to the matrix.
For example,
x = rand(8,8);
I = indexsort(x[:,1]);
x = x[I, :];
- find(x, v): find v in x (a vector, matrix, or list).
Returns the index of the first occurence.
- findall(x, v): find v in x (a vector, matrix, or list).
Returns the indices of the all occurences.
- sfind(x, s): find an entry of x that belongs to set
s.
Returns the index of the first occurence.
- sfindall(x, s): find entries of x (a vector, matrix, or list)
that belong to set s.
Returns the indices of all occurences.
- findmax(x):
find the maximum of x.
Returns the index of the first occurence.
- findallmax(x):
find the maximum of x.
Returns the indices of all the occurences.
- findmin(x):
find the minimum of x.
Returns the index of the first occurence.
- findallmin(x):
find the minimum of x.
Returns the indices of all the occurences.
oz
2009-12-22