Main Content

Simulink.fault.findConditionals

Retrieve conditionals from model

Since R2023b

Description

conditionals = Simulink.fault.findConditionals(model) returns the conditionals from the model, model. The function returns the conditionals alphabetically by name.

example

conditionals = Simulink.fault.findConditionals(model,property=value) finds the conditionals filtered by the Conditional object property, property, that match the value, value. The function returns complete and partial matches.

example

conditionals = Simulink.fault.findConditionals(model,property1=value1,...,propertyN=valueN) finds the conditionals filtered by one or more Conditional object property values.

example

Examples

collapse all

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add a conditional to the model with the name myConditional and the expression y1 >= 0.

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

Retrieve the conditional.

fault_conditional = Simulink.fault.findConditionals(...
"fault_analyzer_intro");

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add three conditionals to the model, each with a specific name and expression.

Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional1","y1 >= 0");
Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional2","y2 >= 0");
Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional22","y3 >= 0");

Retrieve the conditionals that contain 2 in the name.

fault_conditionals = Simulink.fault.findConditionals(...
"fault_analyzer_intro",Name="2");

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add three conditionals to the model, each with a specific name and expression.

Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional1","y1 >= 0");
Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional2","y2 >= 0");
Simulink.fault.addConditional(...
"fault_analyzer_intro","myConditional22","y3 >= 0");

Retrieve the conditionals that contain 2 in the name and have y2 in the Condition property.

fault_conditionals = Simulink.fault.findConditionals(...
"fault_analyzer_intro",Name="2",Condition="y2");

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 property, specified as a property of the Conditional object. For more information on Conditional object properties, see Properties.

Value of the property, specified in the format determined by the property. You can define this argument by using a regular expression.

Output Arguments

collapse all

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

Version History

Introduced in R2023b