title: Matlab - How to mask a 3-D image using a binary image
body: <p>I have an image with red, green, blue channel and a binary version of the image.</p>
  
  <p>What I want to do is concatenate those 2 images so that the binary image works as the mask for the normal image.</p>
  
  <p>I want to select only the pixels from the color image which are 1 in binary.</p>
  
  <p>I know that this should work with <code>cat</code>, or even with <code>repmat</code>, but since I'm pretty new to Matlab I can't figure out how to do this, even after reading the docs of the functions.</p>