Main Content

deleteSymbol

Delete a symbol object definition from a Python Code block

Since R2025a

Description

deleteSymbol(mySymbolSpec, name) deletes the Symbol object with the Name property specified by name from the SymbolSpec object.

example

Examples

collapse all

Access and edit the properties of a symbol used in a Python Code block.

Obtain the SymbolSpec object of the Python Code block in your model using get_param. For example, select the Python Code block in the model canvas and enter the following at the command line.

mySymbolSpec = get_param(gcb, 'SymbolSpec');

Use the addSymbol function to specify a new parameter symbol, myParam, in your Python Code block code.

myParam = addSymbol(mySymbolSpec, 'myParam')

The Symbol object, myParam, uses default properties. Specify the scope of the symbol using the Scope property.

myParam.Scope = 'Parameter';

You can use the getSymbol function to access symbols specified for the block. For example, access the parameter symbol you added.

myParam = getSymbol(mySymbolSpec, 'myParam');

Edit the label of the parameter in the Block Parameters dialog box using the Label property.

myParam.Label = 'Amplitude';

To delete a symbol from the SymbolSpec object, use the deleteSymbol function.

deleteSymbol(mySymbolSpec, 'myParam');

Input Arguments

collapse all

Symbol specifications of Python Code block, specified as a SymbolSpec object.

Name of the symbol to delete, specified as a character vector.

Data Types: character

Version History

Introduced in R2025a