MATLAB: Changing matrix column order

column reorderMATLABmatrix

An having difficulty expressing the result I would like, but it is shown in the example below. How can I change the order of matrix A's columns so that they are like matrix B, regardless of the data values.
A =
1 2 3 11 22 33 111 222 333
1 2 3 11 22 33 111 222 333
1 2 3 11 22 33 111 222 333
1 2 3 11 22 33 111 222 333
B =
1 11 111 2 22 222 3 33 333
1 11 111 2 22 222 3 33 333
1 11 111 2 22 222 3 33 333

Best Answer

reshape(permute(reshape(A,size(A,1),3,[]),[1 3 2]),size(A,1),[])