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 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 = "SimpleMotorArmatureWindingFault/DC Motor/Armature winding assigns the symbol to the armature winding of the DC Motor block.

Data Types: char | string

Examples

collapse all

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Add a conditional named myConditional to the model, and specify the condition expression as y1+y2 >= 0.

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

Retrieve the symbols defined in the expression.

mySymbols = getSymbols(faultConditional)
mySymbols = 

  1×2 Symbol array with properties:

    Type
    Expression
    Path
    Name

Version History

Introduced in R2023b

See Also

|