When you use imagesc() without specifying XData or YData (or x and y), then the default XData is to place the center of the pixels one data unit apart, so they would be at 1, 2, 3, ... number of columns. When you then set your XLim to [0 1] you are restricting the view on the image to show only what is visible in x range 0 to 1. That is going to be only half of the first column of pixels (with 1 as the center, the first pixel would occupy from 0.5 to 1.5 on the x axis.)
If you want the image to be placed within the range [0 1] then you should instead be using
imagesc(matrixA(:,:,1), [0 1], 'XData', [0 1], 'YData', [0 1]);
However, you might want to adjust that slightly to take into account that those are the centers you are specifying. For example you might want something like
x = linspace(0, 1, size(YourImage,2)+2 );
xlimit = [x(2), x(end-1)];
and then use xlimit as the XData for imagesc
Best Answer