reshape 3d matrix to obtain a column vector
20 次查看(过去 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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!