Is there a way to display the single number (not the RGB triplet)?
Here are two ways to explore the CData in your image interactively.
Show CData value under the cursor
This uses the axes currentPoint property that shows the location of your cursor within the axes. It assumes that the image's XData and YData properties are default where pixels are centered on consecutive integers. Pardon the poor GIF quality.
rgb = imread('moon.tif');
txt = text(ax,nan, nan, '', 'FontSize', 10, 'Color','r','VerticalAlignment','bottom');
set(gcf,'WindowButtonMotionFcn', {@showCData,txt,ax,I})
function showCData(~,~,txt,ax,I)
currpt = round(ax.CurrentPoint(1,1:2));
isInImg = inpolygon(currpt(1),currpt(2),ax.XLim([1 2 2 1]),ax.YLim([1 1 2 2]));
str = string(I.CData(currpt(2),currpt(1)));
set(txt,'Position', [currpt,0], 'String', str)
Show all CData values within a subsection of the image
Showing all CData values across the entire image would exhaust the graphics system unless the image was very small. Insead, this use the LimitsChangedFcn to detect when the x-axis limits have changed (you can adapt it to respond to the y-axis too). When the limits result in a smaller subsection of pixels, a threshold I set to 15 pixels along the x-axis, the CData values will turn on within the frame. This demo also assumes that the image's XData and YData properties are default where pixels are centered on consecutive integers.

rgb = imread('moon.tif');
ax.XAxis.LimitsChangedFcn = {@imageZoomLabeler,I};
function imageZoomLabeler(ruler,limitsChanged,img)
xrng = limitsChanged.NewLimits(2)-limitsChanged.NewLimits(1);
x = ceil(limitsChanged.NewLimits(1)) : floor(limitsChanged.NewLimits(2));
y = ceil(yl(1)) : floor(yl(2));
xm = x.*ones(numel(y),1);
ym = y.'.*ones(1,numel(x));
ind = sub2ind(size(img.CData),ym,xm);
str = string(img.CData(ind));
texthandles = text(ruler.Parent,xm(:),ym(:),str(:), ...
'FontSize',10,'Color','r',...
'VerticalAlignment','middle',...
'HorizontalAlignment','center');