Monday, 27 February 2012

In LabVIEW, How Do I Programmatically Change the Properties of Objects in a Cluster? - National Instruments



In LabVIEW, How Do I Programmatically Change the Properties of Objects in a Cluster?

Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: I am trying to access individual objects from my cluster in LabVIEW and programmatically change the properties of them. How can I do this?

Solution:
In order to programmatically change a property for an individual element in a cluster, you need to get access to the control reference for that element. There are three ways of gaining access to the control reference of an object inside a cluster in LabVIEW.
  1. The first is to create References or Property Nodes of the individual objects before placing them in the cluster. To do this, right-click on the object and select Create»Reference orCreate»Property Node. Then, if you created a reference, wire this reference into a Property Node found on the Functions Palette»Applications»Property Node and change the property to appropriate one you want by clicking on the Property Node with the Operate Value tool. Lastly, place the object in the cluster on the front panel.

  2. The second way is by creating References or Property Nodes of the individual elements from the front panel. First, go to the front panel and right-click on the individual element in the cluster that you want to access and select Create»Reference or Create»Property Node. Now, the reference or property node for the individual element should be available on the block diagram.

  3. The third way to do this is to create a Property Node for the cluster by right-clicking on the cluster from the block diagram and select Create»Property. With the Operate Value tool, select the Controls[ ]: property and then use the Index Array function to access each object based on their logical order within the cluster. Then wire the output of the Index Array function into a Property Node found on the Functions Palette»Applications»Property Node and change the property to appropriate one you want by clicking on the Property Node with the Operate Value tool.

The image below illustrates the three methods discussed above. In this case, the user wants to disable one boolean within the cluster programmatically.



No comments: