Main Content

Simulink.fault.addConditional

Add conditional to model

Since R2023b

Description

example

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

Examples

collapse all

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

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

faultConditional = Simulink.fault.addConditional(...
"fault_analyzer_intro","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