matlab按某一列排序

Excel中有按某一列排序,同时扩展到其他列,Matlab中对应的有sortrows:

The MATLAB function sortrows(A,j) sorts the rows of the matrix a based on the entries of the j-th column. For example, enter the following in MATLAB:

A = [1 2 3

    3 0 9

    6 5 4]

B = sortrows(A,2)

C = sortrows(A,3)

You will receive the following output:

B = 3 0 9

  1 2 3

  6 5 4

C = 1 2 3

   6 5 4

   3 0 9

http://kb.iu.edu/data/afrd.html

posted @ 2013-06-02 10:43  ttang  阅读(18700)  评论(0编辑  收藏  举报