I have a 4d matrix M, with size: a * b * c * n
This is exactly what I want: M(:,:,:,1).*M(:,:,:,2).*...*M(:,:,:,n) (this is element wise multiplication of the elements)
Read Matlab's Help entry, which tells you exactly how to take the product over a desired dimension (index). I will help you if you're stuck, but I will not do all your work for you.