How to create a custom color spectrum from an array...?

2 ビュー (過去 30 日間)
Shivakumar
Shivakumar 2011 年 9 月 19 日
I have an array that is something like this: x = [1000,1200,1300,1250,1340,1020,...]
It goes to about 600 "columns."
Now if I want to take those numbers and turn them into a color spectrum, how do I go about doing that...? I have considered doing it manually and actually write out an if/else statement where it goes through each element and finds out what "bin" that it corresponds to and then assign a color.
Then when putting it together, it will create a "color spectrum". But in my case I just want a visual image of the array which looks like a color spectrum.
I was hoping to avoid that if possible. So is there a shortcut to do what I need without having to brute force it...?
Thanks in advance.

回答 (1 件)

bym
bym 2011 年 9 月 19 日
you can customize a colormap to your data, for example:
jet(600);
would produce the color map 'jet' to map your array to a unique color
doc colormap
don't know if this is what you are looking for

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by