MATLAB: How to label each pixel of the output of IMAGESC with its value MATLAB I have drawn an image with the IMAGESC command and would like to label each pixel with its value. Best Answer The following code illustrates how this might be done:% Generate Random DataN = 5;M = rand(N);x = repmat(1:N,N,1); % generate x-coordinatesy = x'; % generate y-coordinates% Generate Labelst = num2cell(M); % extact values into cellst = cellfun(@num2str, t, 'UniformOutput', false); % convert to string% Draw Image and Label Pixelsimagesc(M)text(x(:), y(:), t, 'HorizontalAlignment', 'Center') Related SolutionsMATLAB: How can display points as coordinates x = rand(10,1) ;y = rand(10,1) ;plot(x,y,'.r')text(x,y,strcat('(',num2str(x),',',num2str(y),')')) ; MATLAB: I have been plotting a optical mask and using the fft function for circular aperture, but i am un able to code for the vertical slit aperture and horizontal slit aperture. Help regarding this is much helpful Use ones() and zeros() to create a slit in a background. Then use fft2(). Related QuestionChanging colors using imagescWrite zero as blankVectorization
Best Answer