Can I make an automatic colorbar that ignores zeros?

조회 수: 10 (최근 30일)
Yoav Romach
Yoav Romach 2017년 3월 5일
댓글: Scott Smith 2022년 8월 19일
Hey,
I'm doing 2d scanning with matlab, I'm plotting the data using imagesc and I do it after every line scan. The initial value for the matrix is all zeros. This means that if I use "caxis auto" I always get that the lower bound for the picture's colorbar is zero and it only changes after after the whole picture is taken. See attached image.
I'm looking for a way to use the automatic colormap, but make it ignore the zeros in the picture. Is there anyway to do it?
Thanks

채택된 답변

Image Analyst
Image Analyst 2017년 3월 5일
Find the non-zero min of your data
maxValue = max(indexedImage);
minValue = min(indexedImage(indexedImage ~= 0));
caxis([minValue, maxValue]);
  댓글 수: 1
Scott Smith
Scott Smith 2022년 8월 19일
Just answered a question I've had for quite some time. Beautifly simple. Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Orange에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by