Jump to content

Cluster data type

From LabVIEW Wiki

A cluster is a LabVIEW datatype that groups data elements of mixed types. A cluster is similar to a record or a struct in text-based programming languages. Clusters can be stored solitarely in a ctl.

Bundling several data elements into clusters eliminates wire clutter on the block diagram and reduces the number of connector pane terminals that subVIs need. The connector pane has, at most, 28 terminals. If a front panel contains more than 28 controls and indicators that you want to use programmatically, you can group some of them into a cluster and assign the cluster to a terminal on the connector pane. Like an array, a cluster is either a control or an indicator. A cluster cannot contain a mixture of controls and indicators.

The color of the cluster on the Block_Diagram gives some insight on the included data-types. A brown cluster consists of numeric data types and numerical actions as 'plus', 'minus' and others can be applied to the cluster directly. Additionally the size of the cluster (bytewise) is fixed. A pink cluster has a variable size because of the use of (for instance) strings or arrays.

Creating Cluster Controls and Indicators

To create a cluster control or indicator, select a cluster on the Controls>>All Controls>>Array & Cluster palette, place it on the front panel, and drag controls or indicators into the cluster shell. Resize the cluster shell by dragging the cursor while you place the cluster shell.

A cluster of three controls

Creating Cluster Constants

Create a cluster constant on the block diagram by selecting a cluster constant on the Cluster palette, placing it on the block diagram, and dragging a constant into the cluster shell.

If you have a cluster control or indicator on the front panel and you want to create a cluster constant containing the same elements on the block diagram, you can either drag that cluster from the front panel to the block diagram or right-click the cluster on the front panel and select Create>>Constant from the shortcut menu.