title: (MATLAB) Colormap for video/animation
body: <p>I have some code that produces a series of grayscale images. I am then able to save the images individually in a loop and save them with a colormap applied. i.e.</p>
  
  <pre><code>file = sprintf('image_%04d.png',x);
  imwrite(image1,jet,file,'png');
  </code></pre>
  
  <p>So i get my images out the other end and they have the correct colormapping which is colormap(jet).</p>
  
  <p>However, when in my next program, I try to cobble these images together to form a short animation (yes I know I should just make the movie in the same loop as above), I get a grayscale movie!!! How does that happen when the source images are color?</p>
  
  <p>Further more I notice that if I load an individual image and then type:</p>
  
  <pre><code>imshow(A)
  </code></pre>
  
  <p>i get a grayscale image too! but if I type:</p>
  
  <pre><code>image(A)
  </code></pre>
  
  <p>it gives me what I wanted, which is the colormapped image. </p>
  
  <p>Why does it do this? 
  how can I get it to make a movie with the correct colormap? 
  and is there a way I can add the colormap to the image before saving it (as above I add the map during imwrite)?</p>
  
  <p>p.s. I have tried using :</p>
  
  <pre><code>video = videowriter(VideoFileName,'MPEG-4')
  video.Colormap = jet  (or) colormap(jet) or 'jet'
  </code></pre>
  
  <p>matlab doesnt like that. :(</p>