From 09:00 PM Friday, August 7 - 10:30 AM CST Saturday, August 8, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# Comparison Modes for Array and Cluster Data

When using certain Comparison nodes to compare data contained in arrays or clusters, you can select from two comparison modes.

Compare elements when you want to compare the individual corresponding elements of the input arrays or clusters.

Compare aggregates when you want to compare the input arrays or clusters in their entirety.

Note

You can select a comparison mode for any Comparison node with two or more inputs, such as Greater?, Equal?, and Less or Equal?. Comparison nodes with only one input, such as Greater Than 0?, compare the data contained in arrays or clusters to an implied second input, such as 0 or not a number. Because this second input is always a scalar, you can only compare elements.

## Example

The following table describes the behavior of Greater? in each of the two comparison modes.

Comparison Mode Input Array 1 (x) Input Array 2 (y) Result (x > y?) Comments
Elements [1,2,3,4] [2,1,4,3] [FALSE, TRUE, FALSE, TRUE]

Greater? compares the individual corresponding elements and returns an array of Boolean values that represent the result of each comparison.

Aggregates [1,2,3,4] [2,1,4,3] FALSE

In Aggregates mode, a Comparison node processes corresponding elements sequentially, checking for inequalities. The node stops as soon as it encounters corresponding elements that are not equal or reaches the end of one of the input arrays or clusters and performs the comparison on those elements.

The first elements in the input arrays are not equal, so Greater? stops and returns a single Boolean value representing the result of 1 > 2?

You can change the comparison mode for a selected Comparison node by selecting Elements or Aggregates on the Item tab in the Compare section.