Example Code

Send Front Panel Control Values to a Variant Array

Code and Documents

Attachment

Overview
This example demonstrates how to write all front panel object values to a variant array.

 
Description
For an in-depth discussion on the Variant data type and it's uses, please see this White Paper.

In summary, Variants are typed variables which can change their data type as needed, allowing the developer to store data of any type in a variant. They are used in a variety of programming languages, and can help to generalize your code.

This code allows the user to select the VI which they would like to generate their variant array from, opens a reference to the VI's Front Panel Controls and cycles through each one's value which it indexes into an array. It then closes the references and the code section ends.

This code has been developed to make it easy to repurpose as a subVI.

 


Requirements

LabVIEW 2013 (or later)


Steps to Implement or Execute Code

1) Download Project & Extract

2) Open project and launch FPtoVariantArray.vi

3) Run the VI

4) Select a VI to analyze in the File Dialog window

5) VI generates Variant Array and ends

 

Additional Images or Video

FPtoVariantArray.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.