sort(x) return index list which sorts x
That is, x(sort(x)) will be in non-decreasing order (x can be an integer, real, or string array). The on-line help documentation for sort explains how to sort multidimensional arrays.
median(x) return the median of the x array
Consult the on-line help documentation for median for use with multidimensional arrays.