Q:

change entire column and row in Matlab

how can I change the positions of entire row and columns in a matrix [nxm]? For example, I want to change my entire 10th row and 10th column into entire 1st column and 1st row.
Thank you.

A:

To replace row 10 with row 1
M(10,:) = M(1,:)

To swap rows 10 and 1
M([10,1],:) = M([1,10],:)

Likewise for columns

