LABVIEW – ASSEMBLING AND DISASSEMBLING CLUSTERS
The Bundle function assembles a cluster from individual elements as shown in below Figure (a). You also can use this function to change the values of individual elements in an existing cluster without having to specify new values for all elements. To do so, wire the cluster you want to change to the middle cluster terminal of this function. When you wire a cluster to this function, the function resizes automatically to display inputs for each element in the cluster. The connector pane displays the default data types for this polymorphic function. In below Figure (b)the input cluster consists of two numeric controls and a string control. The value of the first numeric control is modified without altering other values.
Functions bundling elements into clusters lets you create clusters programmatically. Complete the following steps to bundle elements into a cluster.
Step 1: Place the Bundle function on the block diagram.
Step 2: If necessary, resize the Bundle function to include the number of inputs you intend to use as elements in the cluster. You cannot leave an input unwired.
Step 3: Wire front panel control terminals or outputs from VIs and functions to the element inputs of the Bundle function. The order in which you wire the inputs determines the cluster element order.
Step 4: Right-click the Output Cluster terminal and select Create»Indicator. LabVIEW returns the bundled cluster in the cluster output.
The Bundle By Name function is used to replace one or more elements in an existing cluster. This function refers to cluster elements by name instead of by their position in the cluster. After you wire the node to an input cluster, right-click the name terminals to select elements from the shortcut menu. You also can use the operating tool to click the name terminals and select from a list of cluster elements. All inputs are required. The connector pane displays the default data types for this polymorphic function. The below Figure shows a Bundle By Name function used to modify the values of an existing input cluster which contains a string control and a numeric control. The new value for both the elements must be given, otherwise LabVIEW shows an error.
The Unbundle function splits a cluster into each of its individual elements. When you wire a cluster to this function, the function resizes automatically to display outputs for each element in the cluster you wired as shown in below Figure. The connector pane displays the default data types for this polymorphic function. Unbundling elements from clusters accesses and arranges all elements in a cluster in their cluster element order. After you unbundle elements from clusters, you can wire each element to VIs, functions and indicators. This method of unbundling a cluster is useful if you need to access all the elements in a cluster. You also can unbundle all the elements from a cluster by name. The steps to unbundle elements from a cluster is place the unbundled function on the block diagram and then wire a cluster to the unbundle function. The data type representation of every element appears as element outputs.
The Unbundle By Name function returns the cluster elements whose names you specify. You do not have to keep track of the order of the elements within the cluster. This function does not require the number of elements to match the number in the cluster. After you wire a cluster to this function, you can select an individual element from the function. The connector pane displays the default data types for this polymorphic function as shown in above Figure.
Unbundling elements from clusters by name accesses and arranges the elements in a cluster by name in their cluster element order. A cluster element must have a label for you to unbundle the element by name. After you unbundle an element(s) from a cluster by name, you can wire the element(s) to a VI, function and indicator. This method of unbundling a cluster is useful if you need to access one element from a cluster that includes elements of the same data type. You also can unbundle all the elements from a cluster without using the name. The steps to unbundle elements from a cluster by name are first place the Unbundle By Name function on the block diagram. Then wire a cluster to the Unbundle By Name function. The first element in the cluster element order appears as an element output. Select an individual element from the function in the following ways:
- Resize the function until the name of the element you want appears.
2. Right-click an element output, select Select Item from the shortcut menu, and select the element you want.
3. Use the operating tool to click an element output and select the element you want from the shortcut menu.