From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Remove Duplicate Strings from a String Array using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This example shows a method of removing duplicate string values from an array.


Description
The Remove Duplicate Strings from Array VI will take an array of strings and use them as names for attributes of a Variant. Because Variants in LabVIEW cannot have multiple attributes of the same name, duplicates are removed. We then retrieve the names of all Variant attributes, sort them, count them, and return them to the user as the array of strings with duplicate values removed.


Requirements

  • LabVIEW Base Development System 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached VI to your computer
  2. Open the VI " Remove Duplicate Strings from Array 2012 NIverified.vi"
  3. Run the program

 

Additional Information or References

VI Block Diagram

 b.png

**This document has been updated to meet the current required format for the NI Code Exchange.**


Milan

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Mads
Active Participant
Active Participant
on

A novel approach...I first thought it was much faster than my own implementation, but I had mixed the two up.

The variant-based method is 3-4 times slower than this one.