if this is element-wise multiplication, and say Y
is the n4*n5 vector:
A=bsxfun(@times,reshape(X,n1,n2,n3,[]),permute(Y(:),[4,3,2,1])));
will give you the result of such multiplication , where A
is a 4D array of length n1,n2,n3,n4*n5.
The function reshape
is used to convert X
from 5D to 4D, and the function permute
is used to "push" the information of Y
into the 4th dimension for the multiplication to be done using bsxfun
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…