标签: matlab vectorization reshape
是否可以使用矢量化而不是以下的for-loop-solution重塑每个3D矩阵片段?
orig3D = rand(228,1,2); for n = 1 : 2 new3D(:,:,n) = reshape(orig3D(:,:,n), [12,19])'; end
答案 0 :(得分:3)
Reshape和permute -
Reshape
permute
new3D = permute(reshape(orig3D, 12,19,[]),[2,1,3])