LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Control Limitations

I need to pass around three related numbers (it's an address) in various parts of my VI's. I was trying to do this with a 1-dimensional array of three elements; however, the array control and indicator allow me to view indefinitely many elements, and I don't see a property node to limit the number of elements.

Suggestions?
0 Kudos
Message 1 of 11
(3,611 Views)
Use a cluster.

0 Kudos
Message 2 of 11
(3,607 Views)
Oh, so put a brown cluster inside of my pink cluster? I guess that would work, but that means that I'll need three separate controls to adjust the address, right?
0 Kudos
Message 3 of 11
(3,604 Views)
You didn't mention having a cluster to begin with, so I don't know if you want to put a cluster inside another cluster. To answer your direct question: without knowing more about your overall use, one could say that there's not much difference between having three separate controls in a cluster for the address as opposed to three different elements of an array.
0 Kudos
Message 4 of 11
(3,594 Views)
Okay, here's the VI, using a brown cluster. It turns out that you *can* have one control bank for an entire cluster. Does this work as well as an array could? (The inc_dec VI just passes the cluster off to a sub-VI that splits and reads it.)
0 Kudos
Message 5 of 11
(3,582 Views)
An array is a big as you make it. If you initialize you array with three elements, and never add or remove elements, that what it will be. 🙂
0 Kudos
Message 6 of 11
(3,576 Views)
Okay, but is there any way to prevent an array control from adding elements?

Also, are there any problems that occur with stacked cluster use, as I've done in the VI above? That brown cluster control is functioning well as near as I can tell, but I've never used that, so I don't know whether it can cause problems elsewhere.
0 Kudos
Message 7 of 11
(3,571 Views)
I can't open the VI since I only have LabVIEW 8.2. If you use an array control you cannot prevent someone from adding additional elements. However, if all you're looking at is the first three elements, it doesn't really matter. You can always hide the index display by right-clicking on the control and unchecking the Visible Items->Index Display item. Just resize the control to display three elements.
0 Kudos
Message 8 of 11
(3,565 Views)
Oooh, thanks smercurio, that would do it!

That said: Now that I've got the cluster control set up, is there any reason to switch back to an array?
0 Kudos
Message 9 of 11
(3,561 Views)
There's really no overriding technical reason, so it's really up to you as far which method you prefer, and which makes more sense for your application. With an array as a control the elements are grayed out until someone actually enters something in the element. With a cluster, that's not the case. However, you can simply set the array to have a default value, and it will look the same as a cluster.
0 Kudos
Message 10 of 11
(3,553 Views)