Cluster elements have a logical order unrelated to their position in the shell. The first object you place in the CLUSTER is element 0, the second is element 1, and so on. If you delete an element, the order adjusts automatically. The cluster order determines the order in which the elements appear as terminals on the Bundle and Unbundle functions on the BLOCK DIAGRAM. You can view and modify the cluster order by right-clicking the cluster border and selecting Reorder Controls In Cluster from the shortcut menu.
To wire clusters to each other, both clusters must have the same number of elements. Corresponding elements, determined by the cluster order, must have compatible data types. For example, if a double-precision floating-point numeric value in one cluster corresponds in the cluster order to a string in the another cluster, the wire on the block diagram appears broken and the VI does not run. If the numeric values are different representations, LabVIEW coerces them to the same representation. The below Figure shows the reordering of a cluster which contains a numeric control (Digital Control), a Boolean control (OK Button) and a string control. By clicking over the number displayed with a black background near the cluster element, we can change the order of the elements. Cluster and ARRAY elements are both ordered, you must unbundle all cluster elements at once or use the Unbundle By Name function to access specific cluster elements. Clusters also differ from arrays in that they are a fixed size. Like an array, a cluster is either a CONTROL OR AN INDICATOR.
The main cluster operations are bundle, unbundled, bundle by name and unbundle by name. Use the cluster functions to create and manipulate clusters. For example, you can perform tasks similar to the following:
The Bundle function assembles individual components into a single new cluster and allows you to replace elements in an existing order. The Unbundled function splits a cluster into its individual components. When it is required to operate on a few elements and not the entire cluster elements, you use the Bundle By Name function. They are referenced by names rather than by position. The Unbundle By Name function returns the cluster elements whose names are specified.
Get Updates on Tech posts, Interview & Certification questions and training schedules