필터 지우기
필터 지우기

reshape 3d matrix to obtain a column vector

조회 수: 25 (최근 30일)
gianluca
gianluca 2014년 7월 30일
답변: Azzi Abdelmalek 2014년 7월 30일
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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 30일
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(:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by