Search code examples
matlabimage-scaling

MATLAB: Imagesc and scaling all images to use one scale


I am using imagesc in a loop to create 100 images. As far as I'm aware, the colour scale is individual in each image.

So my first question is...does each image have a different scale?

(my results would indicate this but I need clarification)

result is a 7x7xt matrix.

Part of the loop showing this is...

 t=100;

 for j=1:t
     figure;
     imagesc(result(:,:,j));
     filename = sprintf('model.png', j);
 end

My second question is...if they do have different scales, is there a simple way to make them all use the same appropriate scale?


Solution

  • Question 1: Yes.

    Question 2:

    If you read the manual page, you'll see it says:

    imagesc(...,clims) normalizes the values in C to the range specified by clims and displays C as an image. clims is a two-element vector that limits the range of data values in C. These values map to the full range of values in the current colormap.