Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Matrix Manipulation
Topic: Sorting and Counting
See also: index

Function: sort
Description: sort sorts the rows of a matrix. If column c1 is specified the matrix will be sorted with respect to column c1. That is, the rows of the matrix will be arranged in order that elements of column c1 are in ascending (descending) order.

Usage: z = sort (x, c)
Input:
x n x p x d1 x ...x dn array
c m x 1 vector
Output:
z n x p x d1 x ...x dn array

Note:

Example:
x  = #(3, 1, 1, 3, 1)~#(4, 5, 4, 2, 4)~#(1, 5, 4, 0, 1)
sort(x', #(-1, 2))

Result:
Contents of sort

[1,]     4     5     4     2     4
[2,]     3     1     1     3     1
[3,]     1     5     4     0     1



(C) MD*TECH Method and Data Technologies, 05.02.2006