Main Content

Simulink.fault.deleteFault

Delete faults from model element

Since R2023b

Description

example

Simulink.fault.deleteFault(modelElement) deletes the faults associated with the model element, modelElement. The function also deletes the fault behaviors associated with these faults.

example

Simulink.fault.deleteFault(modelElement,name) deletes the fault with the name, name, and its associated behavior.

Examples

collapse all

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Add two faults to the DC Motor block.

Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding",...
Name="myFault1");
Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding",...
Name="myFault2");

Delete the faults associated with the DC Motor block.

Simulink.fault.deleteFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding");

Open a model with a block that supports fault modeling.

openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')

Add two faults to the DC Motor block.

Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding",...
Name="myFault1");
Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding",...
Name="myFault2");

Delete the fault, myFault1.

Simulink.fault.deleteFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding","myFault1")

Input Arguments

collapse all

Path or handle of model element, specified as a string scalar, character vector, or handle. This argument is the path of a fault-capable model subelement.

Example: "myModel/DC Motor/Armature winding"

Data Types: string | char | double

Name of the fault, specified as a string scalar or character vector.

Data Types: char | string

Tips

  • Deleting faults also deletes the associated fault behavior in the fault model. To delete only the fault behavior, use the deleteBehavior function.

  • Deleting faults automatically saves the fault information file.

  • If you delete a fault and the associated fault behavior is the only one in the fault model, you also delete the fault model.

Version History

Introduced in R2023b