title: Matlab colormap - How can I change only ONE specific value, not a range of values?
body: <p>This is my first question on StackOverflow so forgive me if I make some mistakes.</p>
  
  <p>I have to visualize multiple single channel images (2D matrices) with MATLAB. The value of each pixel usually ranges between <code>~10^-10</code> and <code>~10^-6</code>. I am using a flipped <code>jet</code> colormap (so dark red is low and dark blue is high).</p>
  
  <p>Now, some of these matrices contain also some <code>0</code> pixel values. I would like to set a specific color (say white) <strong>only</strong> for these pixels. What i did for now is:</p>
  
  <pre><code>cmap = colormap('jet'); % standard 64 colors jet colormap 
  cmap = flipud(cmap);
  </code></pre>
  
  <p>Then I tried to edit the first row of the colormap and setting it to <code>[1 1 1]</code> (white) following different answers I found online (including <a href="https://stackoverflow.com/questions/4781941/how-do-i-change-a-single-color-in-a-colormap-in-matlab">How do I change a single color in a colormap in Matlab?</a>):</p>
  
  <pre><code>cmap(1,:) = [1 1 1];
  colormap(cmap);
  </code></pre>
  
  <p>The problem is that this edit of the colormap sets the first <strong>range/64</strong> values (I guess) of the image to white, instead of setting only the <code>0</code> ones to white.</p>
  
  <p>I was wondering: is it possible to set <strong>only</strong> those pixels to white?</p>
  
  <p>I guess that my problem depends on the fact that even for the images with these few <code>0</code> valued pixels, the second lowest pixels are <strong>many</strong> and really <strong>small</strong> (in the order of <code>10^-10</code>).</p>
  
  <p>Thank you very much in advance! Best wishes!</p>
  
  <p>UJIN</p>