【问题标题】:MATLAB: Reshape every slice of a 3D matrixMATLAB:重塑 3D 矩阵的每个切片
【发布时间】:2018-03-02 23:49:06
【问题描述】:

是否可以使用矢量化而不是以下 for 循环解决方案来重塑 3D 矩阵的每个切片?

orig3D = rand(228,1,2);

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

【问题讨论】:

    标签: matlab vectorization reshape


    【解决方案1】:

    Reshapepermute -

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

    【讨论】:

      猜你喜欢
      • 2018-03-06
      • 2018-03-02
      • 2015-01-24
      • 2018-07-09
      • 1970-01-01
      • 1970-01-01
      • 2011-01-16
      • 1970-01-01
      • 2012-01-31
      相关资源
      最近更新 更多