reshape 3d matrix to obtain a column vector

20 visualizaciones (últimos 30 días)
gianluca
gianluca el 30 de Jul. de 2014
Respondida: Azzi Abdelmalek el 30 de Jul. de 2014
Hi, I've a 3D Matrix A(3x3x3):
A(:,:,1) = [1 2 3; 4 5 6; 7 8 9]
A(:,:,2) = [10 11 12; 13 14 15; 16 17 18]
A(:,:,3) = [19 20 21; 22 23 24; 25 26 27]
I would obtain a column vector (27x1) like
B = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16 ...]
Any suggestion? Thanks, Gianluca

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 30 de Jul. de 2014
A(:,:,1) = [1 2 3; 4 5 6; 7 8 9]
A(:,:,2) = [10 11 12; 13 14 15; 16 17 18]
A(:,:,3) = [19 20 21; 22 23 24; 25 26 27]
B=permute(A,[2 1 3])
out=B(:)

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by