Matrix rows or columns sorting
[mat2,I] = CL_sortMat(mat [,u ,direction]);
Sorts the rows or columns of a matrix according to the sorting order of a vector.
- If u is a column vector, the rows of mat will be sorted in the same order as the rows of u.
- If u is a row vector, the columns of mat will be sorted in the same order as the columns of u.
- If u is empty (or absent), the values of mat will be sorted if mat is a row or column vector.
The sorting order is determined by direction (increasing by default).
Matrix (PxN)
(optional) Row or column vector (1xN or Px1) or empty. Default is empty
(string, optional) Sorting order: "i" = increasing, "d" = decreasing. Default is "i" (1x1)
Sorted matrix (PxN)
Sorting index (u_sorted = u(I)) (1xN or Px1)
CNES - DCT/SB