Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Creating and Editing User-Defined Constants

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Constants are terminals on the block diagram that supply fixed data values to the block diagram. Universal constants are constants with fixed values, such as pi () and infinity (). User-defined constants are constants you define and edit before you run a VI.

Complete the following steps to create a user-defined constant.

  1. Right-click an input terminal of a VI or function and select Create»Constant from the shortcut menu. LabVIEW creates a constant of the default data type of the input terminal and highlights the value.
  2. Type the value you want to assign to the constant and press the <Enter> key. You also can press the up and down arrow keys to assign a value to the constant. LabVIEW resizes the constant to fit its contents. You can resize a string constant the same way you resize a label.
  3. Use the Operating or Labeling tool to click the constant and edit its value. If automatic tool selection is enabled, double-click the constant to switch to the Labeling tool and edit the value.
Note  LabVIEW uses constant folding to optimize the performance of VIs. You can display constant folding on the block diagram by selecting Tools»Options, selecting Block Diagram from the Category list, and placing a checkmark in the Show constant folding of wires checkbox.

You also can create a constant in the following ways:

  • Search for a constant or select it on the Functions palette and add it to the block diagram. Most constants are located at the bottom or top of their palettes.
  • Search the LabVIEW Help for a constant and click the Add to the block diagram button to place the constant on the cursor so you can add it to the block diagram. Click the Find on the palette button to highlight the constant on the Functions palette.
  • Drag a front panel control to the block diagram. LabVIEW creates a constant with the value of the front panel control at the time you dragged it to the block diagram. The value of a refnum constant is Not A Refnum. The control remains on the front panel. Changing the value of the front panel control does not affect the constant value on the block diagram and vice versa.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit