Contents Previous Next Subchapters Current Chapters-> align atod atoi char2dbl ntoa num2str str2num strreplace strclip clipstr low2up up2low dquote file2str pack unpack char2id reprow str2strdir sort sort3 psort psort3 mlmode_sort reverse flipud fliplr rot90 nonzeros find find2 find3 dec2hex hex2dec findstr whichrow Parent Chapters-> Omatrix6 stringssort psort Search Tools-> contents reference index search

Sorting The Rows Of A Matrix By Pointers
 Syntax `psort(`matrix`)` See Also sort , pmax , reverse , and psort(matrix, start, width)

Description
Returns an integer column vector containing a ranking of the rows of matrix, where matrix is an integer, real, double-precision, or character matrix. The first element of the returned vector contains the row number of the smallest row in matrix, the second element contains the row number of the next largest, and so on. One row of matrix is considered larger than another in the same sense as in sort(matrix) .

Example
If you enter ```      x = {"Baker", "Alpha", "Charlie"}      p = psort(x)      print p ``` O-Matrix will respond ```      {      2      1      3      } ``` The 2 is the row number of "Alpha", the 1 is the row number of "Baker", and the 3 is the row number of "Charlie". If you continue the previous example by entering ```      x(p, :) ``` O-Matrix will respond ```      Alpha      Baker      Charlie ```