SORTDIM Function
Sorts one dimension of a multidimensional array.
Usage
result = SORTDIM(array, dimension)
Input Parameters
array—The array to be sorted.
dimension—An integer specifying the dimension to be sorted. dimension must be greater than or equal to 0.
Returned Value
result—An array with the same type, dimensions, and data as array, but where each column along the dth dimension is sorted.
Keywords
None.
Discussion
SORTDIM is used to sort one dimension of an array, e.g., to sort each column of a matrix.
Example
s = 0
a = BYTSCL(RANDOMU(s, 4, 5))
PM, a
; PV-WAVE prints the following:
;   0 145 186 227 183
;  36  59 255   9   2
; 206  12 105  14 105
; 125 185 142 145  18
 
; Sort the columns.
PM, SORTDIM(a, 0)
; PV-WAVE prints the following:
;   0  12 105   9   2
;  36  59 142  14  18
; 125 145 186 145 105
; 206 185 255 227 183
 
; Sort the rows.
PM, SORTDIM(a, 1) 
; PV-WAVE prints the following: 
;   0 145 183 186 227
;   2   9  36  59 255
;  12  14 105 105 206
;  18 125 142 145 185