Filter löschen
Filter löschen

reshape 3d matrix to obtain a column vector

25 Ansichten (letzte 30 Tage)
gianluca
gianluca am 30 Jul. 2014
Beantwortet: Azzi Abdelmalek am 30 Jul. 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

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 30 Jul. 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(:)

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by