title: Multidimensional Arrays Multiplication in Matlab
body: <p>I have the following three arrays in Matlab:</p>
  
  <p>A size: 2xMxN</p>
  
  <p>B size: MxN</p>
  
  <p>C size: 2xN</p>
  
  <p>Is there any way to remove the following loop to speed things up?</p>
  
  <pre><code>D = zeros(2,N);
  for i=1:N
      D(:,i) = A(:,:,i) * ( B(:,i) - A(:,:,i)' * C(:,i) );
  end
  </code></pre>
  
  <p>Thanks</p>