MATLAB:重塑整个3D矩阵的切片

时间:2017-09-21 14:51:03

标签: matlab vectorization reshape

是否可以使用矢量化而不是以下的for-loop-solution重塑每个3D矩阵片段?

orig3D = rand(228,1,2);

for n = 1 : 2
    new3D(:,:,n) = reshape(orig3D(:,:,n), [12,19])';
end

1 个答案:

答案 0 :(得分:3)

Reshapepermute -

new3D = permute(reshape(orig3D, 12,19,[]),[2,1,3])