Name

CL_matSort — Sorts increasingly or decreasingly a row or a column of a matrix

Calling Sequence

   [B] = CL_matSort(A,num,[par1,par2]);
   
   

Description

  • Sorts increasingly (par2='i') or decreasingly (par2='d') a row (par2='r')or a column (par2='c') of a matrix A.

    Other columns or rows of the matrix are sorted accordingly

    By default : a row is sorted increasingly

Parameters

A:

matrix to be sorted (MxN)

num:

row or column number to be sorted(1 x 1)

par1:

(optionnel) 'c' = column ; 'r' = row

par2:

(optionnel) 'i' = increasingly; 'd' = decreasingly

B:

sorted matrix (m x n)

Authors

CNES - DCT/SB

See also

Examples

A=[1,3,2;1000,1010,1020;10,80,15];
// Sort of 2nd column increasingly, other columns sorted accordingly
[B] = CL_matSort(A,2);

// Sort of 3r row decreasingly, other rows sorted accordingly
[B] = CL_matSort(A,3,'r','d');