Search code examples
matlabmatrixmatrix-inverse

invert matrix in matlab/sorting a matrix in matlab


I have this problem that I need to sort a matrix in MATLAB.

Input:(2x5 matrix)

1    2
3    4
5    6
7    8
9    10

And I'd like the output to be.(2x5)

9   10
7   8
5   6
3   4
1   2

I would like to invert first matrix, help is needed.


Solution

  • Flip the array upside down by using flipud.

    A = [1, 2; 3, 4; 5, 6; 7, 8; 9, 10];
    B = flipud(A);