MATLAB: How to plot a histogram from 0-255

imhist

I use img1=imread function to load my image into matlab. The image is 512by512 and the intensity range is 0-255. However the histogram of my image ( which I use imhist(img1) to plot it) has values only at 0 and 1. How is that? I mean when I take a look at the array of my picture, I see numbers varying from 0-255. Is it because I am using imhist? Any idea would be appreciated. and sorry if the question might be very basic for some of you.

Best Answer

I = imread('cameraman.tif');
imhist(I)
shows values from 0 to 255. Do you change I after imread and before imhist?