Example Code

Using Variant Attributes to Build a Dictionary or Look-up Table 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

Download All

Overview

This example shows how to store any type of data as the value by using Variant in LabVIEW

 

Description

One useful data type for many types of programs is a dictionary or look-up table, where data is stored as a key -> value pairing. An example of this would be a contact list, where the person's name is the key and their phone number is the value.A great way to solve this problem in LabVIEW is with variants. By using the Set Variant Attribute and Get Variant Attribute functions, you can easily build and access a dictionary.


Requirements

LabVIEW 2012(or compatible)


Steps to Implement or Execute Code

  1. Run the vi.
  2.  Input the name

 

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

 

Daniel E.
TestStand Staff Product Support Engineer
National Instruments
CTA/CLD

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

Comments
NJKirchner
Member
Member
on

A great wrapped implementation of this feature can be found here

https://decibel.ni.com/content/docs/DOC-47630

Gives cleaner API experience with all the same functionality    

ijustlovemath
Active Participant
Active Participant
on

@NJKirchner, do you have a more recent link? That one redirects to the forums.