Main Content

Persistent Variable Read

Read persistent variable value from target computer

  • Library:
  • Simulink Real-Time / Target Management /

  • Persistent Variable Read block

Description

The Persistent Variable Read block reads the selected persistent variable from the target computer when you load the real-time application. If the block cannot find the selected variable, the block outputs the selected default value. The variable value persists when the target computer is shut down.

Use the getPersistentVariables function and setPersistentVariables function to access the persistent variable values on the target computer.

Ports

Output

expand all

The data type and dimensions of the Persistent Variable Read block output port are set by the Default value parameter. If these properties do not match those of the variable stored on the target computer, an error occurs during real-time application load.

The block can take a complex number. The complexity of the Persistent Variable Read block output port is set by the Default value parameter. If this property does not match the complexity of the variable stored on the target computer, an error occurs during real-time application load.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean

Parameters

expand all

The Variable name parameter provides the name of the persistent variable. Use this name to access the variable in the structure of variable values retrieved from the target computer by using the getPersistentVariables function.

Programmatic Use

Block Parameter: varName

The Default value parameter provides a starting value for the persistent variable when the variable does not exist on the target computer. This parameter sets the data type and dimensions of the Persistent Variable Read block output port.

Programmatic Use

Block Parameter: defaultValue

Version History

Introduced in R2022a