You probably want ind2rgb. But if you're using imagesc, rather than image, you're probably need to scale your color values. It looks something like this: v = ??;
map = colormap;
minv = min(v(:));
maxv = max(v(:));
ncol = size(map,1);
s = round(1+(ncol-1)*(v-minv)/(maxv-minv));
rgb_image = ind2rgb(s,map);
If you have integer color values, then you don't need to do that scaling before calling ind2rgb.
Best Answer