Example Code

Programmatically Change Waveform Channel Names 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

1. Overview: 

This example shows you how to programmatically change the names of Waveform using Set Waveform Attribute.  This will allow for updated names within the Plot Legend.

  

2. Description

Waveform Graph_Modified Channel Name programatically changes the names of the channels in the plot legend, and Waveform Graph keeps the names of the channels as they were originally.

1. Wire a for loop to the number of waveform channel names you want to change
2. Place a Set Waveform Attribute down with a NI_ChannelName string constant
as the input to Name
3. Wire in the waveform signal to Waveform in Set Waveform Attribute
3. Wire a string constant array with the new names of the channels to Value of the Set Waveform Attribute

This can be done with arrays or dynamic data types.  For dynamic data types you need to convert the signal to its component waveforms.

 

3. Requirements

LabVIEW 2012 (or compatible)

  

4. Steps to Implement or Execute Code

1. Open the VI "Programatically Change Waveform Channel Names_LV2012_NI Verified"

2. Set the new channel names

3. Run the VI

4. Names of the channels in the plot legend are updated

 

5. Additional Information or References

BD.PNG

 

FP.PNG

 

 

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

 

Cheers,
Kelly R.
Applications Engineer
National Instruments

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

Comments
Todd S.
NI Employee (retired)
on

Thanks for posting!  Could you please rename your attachment to include the LabVIEW version?  "_lvXX.vi" is good enough.  Thanks!

Todd S.
LabVIEW Community Manager
National Instruments