Computes the min and max values within the input array, convert to 256 values, and apply a colormap to produce a color image (RGB).
It is possible to specifies the range of values to consider, as well as the background color (used for NaN values).
% Display a default matrix
subplot(1, 2, 1);
% display the coresponding RGB image
subplot(1, 2, 2); imshow(double2rgb(peaks(128), jet, [-8 8]));
Great code! I needed to obtain the corresponding color for an array in gray scale and it perfectly worked for me.
the two features that make this file a little bit different are:
* it works for 2D or 3D images
* it is possible to specify a color for "background", i.e. NaN values.
But I think these options could be easily added to other files you mentioned.
From the help text it seems like this does exactly the same thing as several other functions available here, e.g. mat2im, real2rgb, etc. What are the benefits?