Convert matrix to different row, column combinations.

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?

 채택된 답변

James Tursa
James Tursa 2018년 7월 16일
B = reshape([A(:,1:2:end) A(:,2:2:end)],[],2);

추가 답변 (1개)

Matt J
Matt J 2018년 7월 16일
편집: Matt J 2018년 7월 16일
Using MAT2TILES,
B = cell2mat( mat2tiles(A,[2,2]).' );

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by