Main Content

Simulink.fault.addConditional

Add conditional to model

Since R2023b

Description

conditional = Simulink.fault.addConditional(model,name,condition) adds a conditional with the specified name, name, and condition expression, condition, to the model, model.

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 >= 0.

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

Input Arguments

collapse all

Path or handle to the model, specified as a string scalar, character vector, or model handle.

Data Types: string | char | double

Name of the conditional, specified as a string scalar or character vector. Each conditional name in the model must be unique.

Data Types: char | string

Condition expression, specified as a string scalar or character vector. When you add symbols to the expression, you create new Symbol objects. To programmatically adjust the properties of symbols, retrieve the Symbol objects by using the getSymbols function.

Example: "y1 >= 0" defines the expression and creates a Symbol object with the name y1.

Data Types: char | string

Output Arguments

collapse all

Conditional assigned to the model, returned as a Conditional object.

Version History

Introduced in R2023b