Ensure Maps and Sets in LabVIEW Containing Equivalent Data Evaluate as Equal

Updated Jun 10, 2021



  • LabVIEW

Depending on the format and content of the data structures, comparing LabVIEW maps and sets with the same size and data content with the Equal? function can sometimes evaluate as not equal. This article explains how to ensure that the comparison evaluates as equal for identical maps and sets.

In order to reliably compare maps and sets in LabVIEW, you must:
  1. Flatten both structures into strings using the Flatten to String function, and
  2. compare the resulting strings using the Equal? function.
The below picture shows the results of this type of comparison, as well as the results of a direct comparison that doesn't evaluate correctly.
Image courtest of cbutcher from NI Community. Shows results of directly comparing identical sets, and comparing identical sets using Flatten to String.
Image courtesy of cbutcher from NI Community

Utilizing the Flatten to String function to convert the sets or maps you compare to strings before the comparison ensures that data structures containing equivalent data evaluate as equal, while unequal structures still evaluate correctly as unequal.