Posts

LabVIEW Channel: Sorting Cluster Arrays

Figure 1: Table with Sortable Columns.

Our LabVIEW programmers are often asked to build user interfaces to interact with configuration settings, data sets, file metadata, and databases.  Some examples of these interactive interfaces include, sorting data by parameters, plotting the top ten vibration peaks from a data set, or searching through data files for strain channels that exceed standard limits.

In LabVIEW, these types of data sets can be represented on the block diagram as an arrays of clusters.  A cluster is a LabVIEW data type that groups data elements of mixed types. A cluster is similar to a record or a struct in text-based programming languages.  An array is a group data elements of the same type. An array consists of elements and dimensions.

The VI shown in Figures 1 & 2 contains a table that is sorted when you double click on a column header.  The VI snippet in Figure 2 contains the VI with subvis removed.

Sortable Table VI Snippet Updated

Figure 2: Sortable Table VI Snippet

The VI snippet in Figure 3 contains some example array cluster sorting examples.  By Default A cluster is sorted by the first element and if there is a match the second element is used and so on. To control the sort priority, unbundle the elements you want to sort by then bundle them back above the original cluster. This new cluster can then be sent to the Sort 1D array VI.

Figure 3: Sort Cluster Array Examples VI Snippet.

For more information about interacting with large data sets in LabVIEW, or our LabVIEW programming services contact Chase Petzinger @ (844) 837-8797 x704.