MATLAB: Switch two row of matrix

matrix manipulationrow

How to switch two row of matrix? For example: matrix A is: 1 3 4; 2 4 5 and Y want to be 2 4 5; 1 3 4 ?

Best Answer

A=[1 3 4; 2 4 5]
A([1 2],:)=A([2 1],:)