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 日

0 投票

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

その他の回答 (1 件)

Matt J
Matt J 2018 年 7 月 16 日
編集済み: Matt J 2018 年 7 月 16 日

0 投票

Using MAT2TILES,
B = cell2mat( mat2tiles(A,[2,2]).' );

1 件のコメント

Filippos Papasavvas
Filippos Papasavvas 2018 年 7 月 17 日
Thank a lot, this also solved my problem!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Data Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by