plotting histogram at each pixel of imagesc, possible?

1 view (last 30 days)
Hi everybody, I have a quick question. I have two variables a=11x119x50 and b=119x50. I am plotting b as imagsc(b). Now I would like to click on pixel of my imagesc(b) and it should give me a plot (plot(a:,i,j) or histogram of values that corerespond to a(:,i,j) where i and j equal to the pixel I click one. Is it possible to do and how? Thanks

Answers (1)

Image Analyst
Image Analyst on 15 Oct 2012
Use ginput() to get a coordinate then get the vector
[column, row] = ginput(1);
vector11 = a(:, row, column);
[counts binCenters] = hist(vector11, numberOfBins);

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!