Matrix ausgeben mit farbigen patches je nach Wert

조회 수: 14 (최근 30일)
Teresa
Teresa 2011년 6월 29일
Hallo,
ich würde gerne eine beliebig große Matrix in einem Fenster ausgeben lassen, sodass negative Werte blau (für kalt) unterlegt sind und positive Werte rot (für warm). Je kleiner bzw. größer der Wert desto blauer bzw. roter wird der Hintergrund. Ich denk mal, dass man das am besten mit patches und colormap macht aber da ich noch nicht so lang mit Matlab arbeite, weiß ich nicht wie das so richtig funktioniert. Werde aus patches einfach nicht schlau. Ich würde mich sehr über Antworten freuen
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 6월 29일
Google Translation:
I would like to make an arbitrarily large matrix in a window, so that negative values are blue (for cold) and positive values highlighted in red (for hot). The smaller or larger than the number the blue or red is the background. I think sometimes that one of the best patches and makes colormap but since I work not so long with Matlab, I do not know how that worked very well. Get out of patches not just smart. I would be very happy about answers

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 6월 29일
imagesc(YourMatrix)
You will have to create your own colormap(), unless you happen to have the Bioinformatics Toolbox, which has the map you want

추가 답변 (2개)

Jan
Jan 2011년 7월 18일
Perhaps this helps. FEX: Editable table.

Teresa
Teresa 2011년 6월 29일
But is it possible to see also the values like in a table? so that the background ist coloured? And how do I create my own colormap?
Thanks for the translation :)
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 6월 29일
A colormap is an N x 3 matrix, each row is an RGB triple, with the first row being for the lowest color index and the last row for the highest color index. For example,
rbmap = zeros(31,3);
rbmap(1:15,3) = linspace(1,0,15);
rbmap(17:end,1) = linspace(0,1,15);
then to use it, you would use colormap(rbmap)
To print colored text to the command window, you can use Yair's cprintf() submission, http://www.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-the-command-window
Coloring the cells of a uitable is possible but also not nice to do. See http://www.mathworks.com/support/solutions/en/data/1-D782JW/index.html?product=ML&solution=1-D782JW

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by