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 first layer (all elements) gets multiplied with the first element of the vector and so on...
Now I have to use a function to do it like this:
function out=fun(matrix,vector)
out=matrix;
for k=1:3
out(:,:,k)=out(:,:,k)*vector(k);
end
Is there a efficient way to do this in just one line without the need for a function?