07-21-2013 02:03 PM
hi
i have a 2d array and want to convert it to a picture.
but i want to crate a color picture.
that the color of each element match the attachment pic.
for example if the element in the 2d array is 10 the color is red.
and if the element in the 2d array is -15 the color is blue
thanks.
Solved! Go to Solution.
07-21-2013
10:25 PM
- last edited on
05-06-2025
12:09 PM
by
Content Cleaner
I believe using "Intensity Graph/Chart" is an option available to you.
You can also refer to the shipped examples : labview\examples\general\graphs\intgraph.llb
If you can attach your data, I can try to make an example code.
07-22-2013 06:13 PM
hi dear moderator
than you for your answer.
i want to convert my 2d array to pic same as matlab.
for example see this vi that i attached for you.
i want the result be same ac this pic(attach).
but i cant do this in labview
thank you so much
07-22-2013 06:22 PM
You are almost there. All you need is add a color array to the bottom of flatten pixmap.
07-22-2013 06:58 PM - edited 07-22-2013 07:01 PM
You need to add an array of colors where the value is a certain color and the array index corresponds to the input value 0..255). In your case, ~element #140 should be red and element #0 should be blue... and anything in-between accordingly.
Here's a quick example, but of course the color ramp (taken from a shipping example) is not exactly right, so you need to do a little bit of work. 😄 I changed the scaling a little bit (x180 instead of x100) and also simplified your code. I have no idea why you think you need so many loops! 😮
07-22-2013 07:59 PM
hi dear altenbach
thank you so much for your help it's very usefull.
in the main vi, my element in 2d array is almost between -300 to 300 and min&max of array is change in every case(because use random in it).
and when i use this rainbow, a white or balck area is creat.(i think that mean the element is lower or upper than range)
how can i set rainbow range with my min &max?
thanks
07-22-2013 08:02 PM - edited 07-22-2013 08:03 PM
You cannot have negative values in a picture. Just offset and scale the data so it is 0..255.
... Or you could use an intensity graph instead.
07-22-2013 08:42 PM - edited 07-23-2013 09:22 AM
altenbach wrote:... Or you could use an intensity graph instead.
Here's a quick example. Now you can easily add or remove markers and change their color to any range you want. Of course if you want negative numbers, use a different datatype. Rest stays the same.

07-22-2013 08:54 PM
what is intensity graph instead?
07-22-2013 09:02 PM
@hamedi wrote:
what is intensity graph instead?
Check second reply of this topic.