LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create "variable array"?

Maybe this attachment post will pass through....
Same VI, Second try.


LabVIEW, C'est LabVIEW

0 Kudos
Message 11 of 18
(1,784 Views)
Sorry it didn't do it...
Here is a picture of the diagram. All boolean controls have been put in a cluster.


LabVIEW, C'est LabVIEW

0 Kudos
Message 12 of 18
(1,784 Views)
> then at situation B, I need to switch on Switch5, etc. Can I write
> just one command, with the switch number as the input, so that it can
> switch on different boolean control (Switch#) at different time? (i.e.
> treating the variables Switch1 to Switch10 as an array of variables
> called Switch#).

Assuming this is for the UI of your application, I'd suggest using an
array of Control references to the Switches. Popup on each of the
switches and create a reference node. Wire those to create an array of
references. Now wherever in your program you want to affect a
particular switch, index the array and operate that reference with a
property node. If you do this commonly, make a subVI that takes the
reference array and the index and does the work the
re.

It is also possible to make the array of references without making the
ten reference nodes using the Controls[] property of the panel, but for
ten switches, this is about the same.

Greg McKaskle
0 Kudos
Message 13 of 18
(1,673 Views)
Thanks. I've modified the VI according to the method you suggested (attached below). It's simple and can do the job. The only shortcoming is that all these variables need to sit in the rectangular cluster box, therefore cannot be considered really having flexible positions.
0 Kudos
Message 14 of 18
(1,784 Views)
No problem. Make the cluter border transparent and you can drag other controls over it using the arrows. The thick shadow cast by overlapping controls disappear at run-time.


LabVIEW, C'est LabVIEW

0 Kudos
Message 15 of 18
(1,673 Views)
An excellent example, and one that I'm adding to my library.

Unfortunately, the booleans in the cluster still cannot be embedded in different pages of a tab control. Unless I missed something (he asked hopefully)?
0 Kudos
Message 16 of 18
(1,673 Views)
Then VI Guy's equally excellent solution is more appropriate.


LabVIEW, C'est LabVIEW

0 Kudos
Message 17 of 18
(1,673 Views)
Thanks again for your help. One observation: to be able to make the cluster border transparent, you should select the cluster control from the "classic controls" category in the Controls Palette, and not the one in the "Array & cluster" category. (I'm using LabView 6i.)
0 Kudos
Message 18 of 18
(1,673 Views)