You can call impixelinfo() to let you see the gray levels as you mouse around over the image.
To get the gray level of the image at a particular location, just index it:
grayLevel = grayImage(row, column);
rgbValues = rgbImage(row, column, :);
or you could use impixel()
pixelValue = impixel(yourImage);
Also I'm attaching a script that converts an image into a CSV file where each column is [x, y, grayLevel] or [x, y, r, g, b]