Convert matrix to different row, column combinations.

1 visualización (últimos 30 días)
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?

Respuesta aceptada

James Tursa
James Tursa el 16 de Jul. de 2018
B = reshape([A(:,1:2:end) A(:,2:2:end)],[],2);

Más respuestas (1)

Matt J
Matt J el 16 de Jul. de 2018
Editada: Matt J el 16 de Jul. de 2018
Using MAT2TILES,
B = cell2mat( mat2tiles(A,[2,2]).' );

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by