From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Did you mean: 

I'm Having trouble creating an array from sensor values

Basically I'm trying to do something that i think should be simple, but is being frustratingly difficult. 


I'm using a color sensor to read some palette of colors, and if x color exists at the current location i want to add y number to an array. The final size of the array is known but i'd like to do it by starting with an array of unknown size (not sure what this is called) in order to check for errors. I have all my icons down but nothing within the array seems to be changing. I've tried using build array, insert into array, and change array element (starting with an array of 0's) but nothing is working. 


Help please, thanks!


included a picture just to show. i've just  been trying to get the array to do something, but have clearly been unsuccessful...


0 Kudos
Message 1 of 6

It helps when you use the i instead of the N to index in the case statement.


greetings from the Netherlands
0 Kudos
Message 2 of 6

that didn't really change anything with my code...

0 Kudos
Message 3 of 6

please post the vi.

I'm sure that I can find other errors next to this one.

For sure you don't want to acces the same valeu in the array, the N is fixed from the beginning, the i is incrementing from zero up to N-1

greetings from the Netherlands
0 Kudos
Message 4 of 6

Ok, I made a simpler version of the code that illustrates what i'm trying to do. Just store sensor values as true or false basically. 



0 Kudos
Message 5 of 6

So the result is either black (contents has to be 1) or NOT black, contents has to be zero.


So you just do the compare and fill that in in the array

like below



by the way you can use this snippet directly if you have lv2013 or higher

greetings from the Netherlands
0 Kudos
Message 6 of 6