LABVIEW has many more functions for ARRAYS than CLUSTERS and it is often required to change array to clusters and clusters to arrays. A cluster can be converted into an array first and converted back to a cluster after performing the required operation from the available array functions. You can convert a CLUSTER with elements of the same data type to an array using the Cluster To Array function as shown in below Figure and use array functions to manipulate the contents. This function cannot be used on a cluster of arrays, since LabVIEW does not allow an array or arrays type of structure.
You can convert a cluster with elements of the same type to an array and use array functions to manipulate the contents. Complete the following steps to convert a cluster to an array.
Step 1: Place a cluster on the FRONT PANEL.
Step 2: Place the Cluster To Array function on the BLOCK DIAGRAM.
Step 3: Wire the cluster to the Cluster To Array function.
Step 4: Right-click the Cluster To Array function and select Create»Indicator from the shortcut menu to create an array indicator.
Step 5: Run the VI from the front panel. The array indicator displays the values of the cluster.
You also can convert an array to a cluster using the Array To Cluster function. This function converts an n element, one-dimensional array into a cluster of n element of the same type. This function is useful when you would like to display the elements of the same type in a front panel but still want to manipulate the elements on the block diagram by their index values. Clusters do not size automatically, you need to specify the cluster size by popping up on function. The default cluster size is 9, and the maximum size permitted is 256.
The Build Cluster Array function is used to create an array of CLUSTERS where each cluster contains an array. This function does it by first bundling each component input into a cluster and then ASSEMBLING all component clusters into an array of clusters.
The Index and Build Cluster Array function indexes a set of array and creates a cluster array in which the ith element contains the ith element of each input array. All array inputs need not be of the same type and the function yields a cluster array containing one element from each input array
Free Demo for Corporate & Online Trainings.