help for matvsort

Sort vector

matvsort input_vector output_vector [, decrease]


matvsort sorts input_vector (a 1 X c matrix or an r X 1 matrix) into numeric order and puts the resulting vector into output_vector. input_vector and output_vector may have the same name.


decrease specifies that values should be in decreasing order. The default is increasing order.


matvsort may make it easier to identify the smallest or largest element(s) of a vector. If a vector b has been sorted into increasing order, its smallest element is accessible as b[1,1] and its largest as b[1,colsof(b)] if b is a row vector and b[rowsof(b),1] if b is a column vector.

The corresponding names are accessible as for example

local c1name : word 1 of `: colnames b'


. matvsort A B


Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

Also see

Online: help for matrix