title: How to convert plot data to image matrix (containing indices of colormap) in matlab
body: <p>I'm experimenting with sparse matrix for which I need some sparse matrix data containing some patterns. The best that can be easily generated are image data 
  eg-</p>
  
  <pre><code>a = 64 * ones (9,1);
  b = [64 64 64 0 0 0 64 64 64];
  c = [64 64 64 0 64 0 64 64 64];
  b = b';
  c = c';
  M = [a a a b c c  b a a a];
  </code></pre>
  
  <p>Genrates simple rectangular pattern. What I want is complex pattens like some curves (x^2 or sinx) in matrix (image data) form. Is it possible to convert them into image data???</p>