sorting

Modified: 2009/09/21 15:18 by omorr - Categorized as: English
Here are vector/matrix built in sorting functions:

sort('vector') - Returns a 'vector' with the values sorted in ascending order.

rsort('matrix/vector','number') - Returns a 'matrix/vector' formed by rearranging columns until specified row,'number', is in ascending order.

csort('matrix/vector','number') - Returns a 'matrix/vector' formed by rearranging rows until specified column,'number', is in ascending order.

reverse('matrix/vector') - Reverses the order of rows in a matrix, or of elements in a vector.

A simple example of using these functions is presented:

sorting

HINT: 2D plot can be represented as two-column matrix. The first column is x-vector and the second is y-vector. If we want to sort this matrix first and then plotting, we need to use eval.

sortplotting

ScrewTurn Wiki version 2.0.37. Some of the icons created by FamFamFam.