Example Code

Store Different Types of Data into the Same Array Using Variants in 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 VI demonstrates how to store different types of data into the same array using Variants.


Description
In LabVIEW you are not usually able to create arrays containing different data types. Using the Variant data type, you are able to convert any data type to a single format and create an array with a consistent data type.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached files to your computer
  2. Open the VI "Create Generic Data Type Array LV2012 NI Verified.vi"
  3. Run the program
  4. Change the Numeric control and click Add Numeric
  5. Change the String control and click Add String
  6. Change the Boolean control and click Add Boolean
  7. Click STOP to stop the VI

 

Additional Information or References

VI Block Diagram

 Create Generic Data Type Array LV2012 NI Verified.png

 

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

Jared S.
Applications Engineering
National Instruments

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