title: MATLAB - Element-wise matrix multiplication using two different sizes matrices
body: <p>I would like to do an element-wise matrix multiplication using the following 2x2x3 matrix in MATLAB</p>
  
  <pre><code>&gt;&gt; filter_1
  
  filter_1(:,:,1) =
  
       0     1
       0     0
  
  
  filter_1(:,:,2) =
  
       1     0
       0     1
  
  
  filter_1(:,:,3) =
  
       0     0
       1     0
  </code></pre>
  
  <p>This matrix will turn out to zero some elements in some matrix dimensions if used in an element-wise multiplication. For example, given another 2x2x3 matrix:</p>
  
  <pre><code>&gt;&gt; frames_original{1}
  
  ans(:,:,1) =
  
     92   87
     93   93
  
  
  ans(:,:,2) =
  
     69   66
     72   71
  
  
  ans(:,:,3) =
  
     42   40
     40   43
  </code></pre>
  
  <p>If I do the element-wise matrix multiplication, it will let some values remain in the resulting matrix, the others will turn out to zero:</p>
  
  <pre><code>&gt;&gt; filtered=double(frames_original{1}).*filter_1
  
  filtered(:,:,1) =
  
       0    87
       0     0
  
  
  filtered(:,:,2) =
  
      69     0
       0    71
  
  
  filtered(:,:,3) =
  
       0     0
      40     0
  </code></pre>
  
  <p>However, this only works if both matrices are of the same size (2x2x3). Now, suppose that I have a big matrix, like a 1500x1500x3 matrix. How to 'slide' my 2x2x3 window performing the element-wise multiplication dealing with the matrix borders accordingly? If using N-D convolution, it doesn't work, as MATLAB deals with this operation as an even-dimensional-window convolution, and what I want is an element-wise multiplication.</p>
  
  <p>Is there any way to do element-wise matrix multiplication using one big matrix and another smaller in MATLAB?  </p>
  
  <p>EDIT: The solution for <a href="https://stackoverflow.com/questions/17790500/element-wise-multiplication-of-matrices-of-differing-dimensions">Element wise multiplication of matrices of differing dimensions</a>
  doesn't work for me because it involves a different element-wise multiplication and requires reshaping, which is what I don't want. </p>