Main Content

getSymbols

Get symbols in conditionals

Since R2023b

Description

symbols = getSymbols(conditional) returns the symbols defined in the conditional, conditional.

symbols = getSymbols(conditional,name) returns the symbol with the name, name.

example

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

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 symbol y1.

mySymbols = getSymbols(faultConditional,"y1")
mySymbols = 

  Symbol with properties:

          Type: 'Expression'
    Expression: 'true'
          Name: 'y1'

Input Arguments

collapse all

Conditional, specified as a Conditional object.

Name of the symbol used in the condition expression, specified as string scalar or character vector.

Output Arguments

collapse all

Symbols in the condition expression, returned as a Symbol object array.

Version History

Introduced in R2023b