Example Code

Convert Enum to Array 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

Download All

Overview

This example demonstrates how to populate the items in an Enum into an array of the same size

 

Description

This example demonstrates how to pull the Item Name from an enum and place each Item into a corresponding array.

 

Requirements

LabVIEW Full Development System 2012 or compatible

 

Steps to Implement or Execute Code

  1. Check the Test Enum placed on the front panel
  2. Run the VI 

 

Additional Information or References

VI Block Diagram

 9849.PNG

 

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

 

National Instruments
Applications Engineer

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

Comments
GrumpyB
Member
Member
on

Yes this works, but the Strings [] property is already an array. The For loop is not necessary in this simple case. If one wanted to modify the elements this could be done in the loop. If used, the For loop can be indexed by the array itself, although the explicit indexing by the Number of Items property may make the code easier to understand. A single property node can support multiple properties; expand it and select both the Strings [] and Number of Items properties.

d.w.b
Member
Member
on

That example requires enum to be a control or indicator object on the front panel. To get the same information from an enum constant use https://sourceforge.net/projects/opengtoolkit/ and Get Strings from Enum__ogtk.vi