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 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");

Retrieve the conditional.

fault_conditional = Simulink.fault.findConditionals(...
"SimpleMotorArmatureWindingFault")
fault_conditional = 

  1×2 Conditional array with properties:

    Name
    Condition
    LogActivity

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

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

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

Retrieve the conditionals that contain 2 in the name.

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

  1×2 Conditional array with properties:

    Name
    Condition
    LogActivity

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

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

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

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

fault_conditionals = Simulink.fault.findConditionals(...
"SimpleMotorArmatureWindingFault",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