reshape 3d matrix to obtain a column vector

20 ビュー (過去 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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by