MATLAB: How can we display each pixel Intensity value of a gray image through loop ……for example to show the output like this….”

pixel intensity value

intensity value of pixel(1,1)=87
intensity value of pixel(1,2)=127
.
.
.
.
.

Best Answer

[C, R] = ndgrid(1:size(YourArray,1), 1:size(YourArray,2));
fprintf('intensity value of pixel(%3d,%3d)=%3d\n', [R(:), C(:), YourArray(:)].' );
If you have more than 999 rows or columns then increase the %3d,%3d to suitable width.
Related Question