3D Matrix multiplication with vector

前端 未结 4 513
一生所求
一生所求 2020-12-10 05:22

This bothers me a bit:

Suppose you have a matrix with three layers.

Is there a simple way to multiply this matrix with a vector of three elements so that the

4条回答
  •  爱一瞬间的悲伤
    2020-12-10 05:58

    Another way is to repeat vector to match the matrix by size:

    out = out.*shiftdim(repmat(vector(:),[1 size(out(:,:,1))]),1)
    

提交回复
热议问题