Symmetrically permute a matrix

The (almost) exact same code:

p = [3, 1, 2] # comma separated so this is a vector as opposed to a 1x3 Matrix
A = [1 2 3; 4 5 6; 7 8 9]
A_permuted = A[p, p]
6 Likes