Main Content

Symbol

Create or modify symbols in conditionals

Since R2023b

Description

Symbol objects represent symbols in condition expressions in conditionals. You can modify the conditional by setting the object properties.

Creation

To create a Symbol object, use the getSymbols object function on a specified Conditional object.

Properties

expand all

Name of the symbol, specified as a string scalar or character vector.

Data Types: char | string

Type of symbol, specified as either "Expression" or "Model Element". Use this property to specify how the symbol retrieves values from the model. If you set Type to "Expression", the symbol uses the values evaluated from a specified expression. If you set Type to "Model Element" , the symbol uses the values evaluated from a specified model element.

Data Types: enumeration

Expression that the symbol is mapped to, specified as a string scalar or character vector. This property appears only if the Type property is "Expression".

Example: symbol.Expression = "1" sets the symbol expression to 1.

Data Types: char | string

Path of the model element to which the symbol is assigned, specified as a string scalar or character vector. This property appears only if the Type property is "Model Element".

Example: symbol.Path = "fault_analyzer_intro/Constant/Outport/1" assigns the symbol to the output signal of the first port of the Constant block in the fault_analyzer_intro model.

Data Types: char | string

Examples

collapse all

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add a conditional named myConditional with the condition expression y1+y2 >= 0.

faultConditional = Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional","y1+y2 >= 0");

Retrieve the symbols defined in the expression.

mySymbols = getSymbol(faultConditional);

Version History

Introduced in R2023b