LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I have different labels for variables in an array?

Hi everyone,
 
Sorry if this has been posted before, but with LabView 8.0, is there any way to have different labels for items in an array?  For example, if I have an array of boolean LEDs, I want to label each one independently because they each mean different things.  How can I do that?  It seems really stupid to have to have them be the same label.
 
Thanks,
 
Jason
0 Kudos
Message 1 of 6
(4,252 Views)

You cannot! An array is composed of all identical elements.

There are a few alternatives, for example you could create a cluster of a string and an LED and place it into an array container. Now you can set the text at will by writing to the string of the desired element.

Message 2 of 6
(4,245 Views)

Yeah, that's what I did, but it is a major pain-in-the-$%^ 🙂  It seems pretty obvious that the labels should be different because arrays are never absolutely identical, as they often represent different things.  Certainly, it is reasonble to expect arrays of LEDs to have different labels.  Thanks for the confirmation, though!

Jason

0 Kudos
Message 3 of 6
(4,242 Views)
Well, maybe you're doing it way too complicated. 😉 Attached is a quick example on how you could do it (LabVIEW 7.0).
 
 
No, I don't think it would make sense to allow different labels for array elements. That would make their representation in memory much more complicated. So you think if you have an array of 1 million DBL numers, it should carry along 1 million different labels of variable length? 😮
 
If the number of LEDs is fixed and small, maybe you should use a cluster instead of an array?
Message 4 of 6
(4,238 Views)

Yeah, I guess I can see how that might take a lot of memory to do.  It does appear strange, though, when using it.  Thanks for the example - I believe that is very similar to what I did - an array of clusters, each cluster containing a LED and string indicator.  Attached is 1/2 of the files I use for conversion.

Jason

 

0 Kudos
Message 5 of 6
(4,229 Views)
I don't think you need the size array to set the number of iterations of you for loop.  If N is unwired, it defaults to the size of the indexing array automajically.
0 Kudos
Message 6 of 6
(4,223 Views)