- Syntax of sortrows
B = sortrows(A) sorts the rows of A in ascending order. For strings, this is the familiar dictionary sort.
B = sortrows(A,column) sorts matrix A based on the columns specified in the vector, column. This input is used to perform multiple column sorts in succession.
[B,index] = sortrows(_) also returns an index vector using any of the previous syntaxes. The index vector satisfies B = A(index,:).
- Systax of reshape
B = reshape(A,sz1,…,szN) reshapes A into a sz1-by-…-by-szN array where sz1,…,szN indicates the size of each dimension. You can specify a single dimension size of [] to have the dimension size automatically calculated, such that the number of elements in B matches the number of elements in A. For example, if A is a 10-by-10 matrix, then reshape(A,2,2,[]) reshapes the 100 elements of A into a 2-by-2-by-25 array.
>> order = [ 0 1 5 6 14 15 27 28
2 4 7 13 16 26 29 42
3 8 12 1