Hi everyone,
It's difficult to explain but I've got an image of an array with elements whose value changes by each iteration, and Matlab automatically changes the colors of the associated value. How can I set that e.g 3 keeps being red, 2 keeps being yellow... by each iteration without changing? Thanks in advance.

답변 (1개)

Image Analyst
Image Analyst 2018년 5월 20일

0 개 추천

MATLAB is most likely changing it because you have code that tells it to change it. And since you haven't shared your code (yet) we can't really say what is causing the change. I don't even know what is being changed. Is it a colormap?

댓글 수: 3

m_vdv
m_vdv 2018년 5월 20일
yes, I've got a colormap, but in the first iteration it tells me that for example -1 is yellow and 0 is purple, but after a few iterations it turns out that 0 is yellow and -1 another color, so the colormap is changing. I just want to have that -1 keeps being yellow and 0 purple... during all iterations.
m_vdv
m_vdv 2018년 5월 20일
I mean I've got a colorbar, not a colormap.
Image Analyst
Image Analyst 2018년 5월 20일
A colorbar requires a colormap. Even if you call colorbar without calling colormap(), the colorbar is using a colormap. If you don't specify a colormap then the colormap being used will adjust to each image you display. If you want it to be constant despite changing the image then you will have to adjust caxis(), and possibly send in a colormap each time you change the image. See the documentation for caxis().

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

카테고리

도움말 센터File Exchange에서 Color and Styling에 대해 자세히 알아보기

태그

질문:

2018년 5월 20일

댓글:

2018년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by