Creating a local variable in LabVIEW involves adding a local variable object to the block diagram and assigning the variable to a control or indicator on the front panel.

Local variables operate outside of the dataflow paradigm that LabVIEW uses. Before creating local variables, understand when to use local variables and performance considerations for local variables.

You might need to use a local variable when writing to one front panel object from two block diagram locations or when reading from one front panel object to two block diagram locations.

To create a local variable and associate it with a front panel object, complete the following steps, based on your approach.
OptionDescription
Create a local variable from a specific front panel object
  1. Right-click an existing front panel object or block diagram terminal and select Create » Local Variable.
  2. Click to add the local variable to the block diagram.
Create a local variable and assign the front panel object separately
  1. Add a local variable (Icon for the local variable in LabVIEW.) to the block diagram from the Functions palette.

    The local variable node is not yet associated with a control or indicator.

  2. Select the front panel object to associate with the local variable.
    • Right-click the local variable node and select the front panel object from the Select Item shortcut menu.
    • Use the Operating tool or Labeling tool to click the local variable node and select the front panel object from the shortcut menu.

    The expanded shortcut menu lists all the front panel objects that have owned labels.

Tip LabVIEW uses owned labels to associate local variables with front panel objects. Label front panel controls and indicators with descriptive owned labels.