Example Code

Create an Enum Array (with all Items selected)

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 code was written for a specific VI (see link), and intended to build an array of Enum with all items selected.

 

Description

An array of Enum is not complicated to create, but when you want to have all the items selected in the whole array you must do that manually. Precisely when your Enum contains a lot of items (45 in my case), it can be a source of error. This VI allows you to set sequentially each item of the Enum in an array.

When you have many items to scribe, I recommend editing the items in an Enum, because you can use the Return (enter) key on your keyboard, and you have the whole list of items in a pop-up window. For editing an array of strings, you must type your text - click the next string control – type your text – and so on... (and of course don't forget to save it as default value).

Therefore, the bottom loop creates an array with the items of Enum but in string type. This is useful when you need this type of data.

I agree that in my case the array containing clusters (where Enum stands), but the principle is the same without cluster functions (constants and bundle by name).


Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

Just run the VI and see what happens. For a highlighted execution move the arrays indicators inside the For loop, and see how it works.

 

Additional Information or References

VI Snippet

1.png

 

 

 

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

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