MATLAB: Convert matrix to different row, column combinations.

transform matrix

Hi!
I have a matrix A= [1 2 5 6 9 10; [3 4 7 8 11 12]
I want to make it to B = [1 2; 3 4; 5 6; 7 8; 9 10; 11 12]
How can I do that?

Best Answer

B = reshape([A(:,1:2:end) A(:,2:2:end)],[],2);