Q:

How to multiply a vector and a 3D matrix

I have a 20 by 1 vector Amp, and a 3D matrix M 100 by 20 by 100.
I want to multiply each element of Amp to its corresponding slice in M.
I already achieved this by a for loop as follows:
Result = zeros(100,20,100);
for i=1:20
   Result(:,i,:) = Amp(i)*M(:,i,:);
end 

But I wonder if there is anyway to make this faster. 
Thanks in advance

A:

Here is how:
Result = bsxfun(@times,Amp.',M);

