You can read data from a local or global variable or write data to it. When you write new data to the variable, the associated front panel control or indicator updates to the new data.

By default, a new variable receives data: it is a write local variable or global variable. You can instead configure a variable to behave as a data source, or a read local or global variable.

  • To configure the variable to behave as a control: Right-click the variable and select Change To Read from the shortcut menu.

    When this node executes, the VI reads the data in the associated front panel control or indicator.

  • To change the variable to receive data from the block diagram rather than provide data: Right-click the variable and select Change To Write from the shortcut menu.

    This kind of variable works as an indicator.

On the block diagram, you can distinguish read local variables or read global variables from their write counterparts the same way you distinguish controls from indicators:

  • A read local variable or global variable has a thick border, similar to a control.
  • A write local variable or global variable has a thin border, similar to an indicator.
Tip Write a value to a global variable before you read from it. Writing before reading ensures that the variable has a known initial value when you access it.