LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update 2D color Array

Hi everyone,

 

I'm trying to create a VI that will update a 2D color array.  I created a 2D array of clusters  that will be updated at the index I specify whenever the VI is called. I intend to use it as a subvi in a state machine and eventually save the updated 2D color array to a file.  I will like to increment the column and update the values and then switch to the next row and repeat the column increment until the entire array is updated.

 

Now my questions are two fold:

 

1) How do I increment the column to the specified size and switch to the next row?

2) How/what is the best method to save the 2D array of colors to a file.

 

 See attached code:

 

Thanks

0 Kudos
Message 1 of 4
(2,880 Views)

I'm having a real hard time understanding what you are tying to do.  I have attached an edited version which has a 2D array of picture box, with a row and column, and new color to replace.  I'd recommend dealing with the values of the data not the properties of the controls being shown but again I don't know what you are trying to do so maybe I am confused.

 

As for saving there are many ways to write data to a file and read it back.  Write and read binary, or casting to a variant writing and reading back, OpenG and MGI has their versions of read/write anything which is semi human readable too.

0 Kudos
Message 2 of 4
(2,862 Views)

Hooovahh,

 

The section of code where you used "Replace array subset" function was actually what I was trying to do. However, the color needs to be updated by a voltage level from the "RGB to color" function wired to the New Color input of "Replace array subset" function. It only needs to be a shade of black depending on the voltage value. I was using the random number function for voltage simulation.

 

My problem was that each time my color array was updated in my sate machine, the value in the previous element reverts back to default even though I wired it through a shift register. The code that I posted earlier was an alternative route I tried to take and it obviously wasn't going too well.

 

The intention was to save all the updated color values to a file.

0 Kudos
Message 3 of 4
(2,854 Views)

Okay here is an updated version that I think does more of what you want.  The low level VI just does the color replace based on a voltage.  There is a grey scale option, but I also added a color option which will be red at 0V, orange at 6V, Green at 8V through 14V, orange again at 16V, and red again at 18V with colors in between for voltages in between.  I left the grey option too if that is what you want where 0V is black, and 12V is white.

 

Run the main VI and pick a voltage level, and a power supply between 1 and 12 then click apply and the color will be changed.  Pick a new power supply and voltage level and the 2D array will be updated keeping the previous changes from the shift register.

0 Kudos
Message 4 of 4
(2,841 Views)