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

2 vues (au cours des 30 derniers jours)
Shivakumar
Shivakumar le 19 Sep 2011
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.

Réponses (1)

bym
bym le 19 Sep 2011
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

Catégories

En savoir plus sur Blue dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by