Main Content

Symbol

Python Code block data symbol

Since R2025a

Description

Define Python Code block symbols and their properties.

Creation

Access a Symbol object through one of the following methods.

  1. addSymbol function

  2. getSymbol function

  3. Access the Symbols property of a SymbolSpec object.

Properties

expand all

Symbol name in source code, specified as a character vector.

Data Types: character

Port number, specified as a scalar integer. For input and output symbols, PortNumber indicates the port index on the block. For parameter symbols, PortNumber indicates the order that the symbol appears in the block parameter mask.

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

Size of the symbol data specified as a character vector containing a scalar integer. You can use a size expression to define the size of an output. Use -1 to inherit size.

Data Types: character

Data type of the symbol, specified as a character vector that evaluates to a numeric data type, or as a Simulink.AliasType object.

Example: mySymbol.DataType = 'int32'

Data Types: char

Scope of the symbol, specified as one of the following values.

  • Input — Input symbol to the Python Code block.

  • Output — Output symbol to the Python Code block.

  • Parameter — Define a symbol as parameter. The parameter name is defined by the Label property of the symbol.

  • Persistent — Define a symbol as persistent data.

Data Types: character

Symbol label, specified as a character vector. For symbols with their scope set to Input or Output, this label appears as the port name on the block. For symbols with their scope set to Parameter, this label is the label that appears on the block parameter mask. You cannot define a label for Persistent symbols.

Data Types: character

Version History

Introduced in R2025a