SORT_ND Name
SORT_ND Purpose
Efficiently perform an N-dimensional sort along any dimension
of an array.
Calling Sequence
inds=sort_nd(array,dimension) Inputs
array: An array of at least 2 dimensions to sort.
dimension: The dimension along which to sort, starting at 1
(1:rows, 2:columns, ...).
Outputs
inds: An index array with the same dimensions as the input
array, containing the (1D) sorted indices. Can be used
directly to index the arary (ala SORT).
Example
a=randomu(sd,5,4,3,2)
sorted=a[sort_nd(a,2)] See Also
HISTOGRAM
Modification History
Tue Aug 22 15:51:12 2006, J.D. Smith <jdsmith@as.arizona.edu>
Written, based on discussion on c.l.i-p, 08/2006.