Example Code

Change Number Format within Array Using Property Nodes 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

Overview

It is designed to be used as a subvi to programmatically converts a number within an

array to any format that is desired (Dec, Bin, Oct, Hex, etc.)


Description
Property Nodes of arrays and clusters cannot be directly accessed by right clicking on the array or cluster in the block diagram.   This is because you cannot change the properties of individual elements in an array.  You must first tell LabVIEW the element type using a reference to the array, the To More Specific Class primitive, and a Class Specifier Constant. 

This example demonstrates this concept. It's designed to change the format of the Numeric Digital element type of an array. The operations take place in a subvi to demonstrate how to programmatically operate on controls and indicators from a subvi. The screen shot below is of the subvi.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  • Select the desired format in the "Format & Precision:Format" control.
  • Run the VI.
  • Change the format.
  • Run the program and note how the representation of array elements changes.

 

Additional Information or References
VI Snippet

2-273.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.