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 the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add two faults to the output port of the Sine Wave block.

Simulink.fault.addFault("fault_analyzer_intro/Sine Wave/Outport/1"...
,Name="myFault1");
Simulink.fault.addFault("fault_analyzer_intro/Sine Wave/Outport/1"...
,Name="myFault2");

Delete the faults associated with the Sine Wave block.

Simulink.fault.deleteFault(...
"fault_analyzer_intro/Sine Wave/Outport/1");

Open the fault_analyzer_intro model.

openExample('faultanalyzer/FaultAnalyzerIntroExample')

Add two faults to the output port of the Sine Wave block.

myFault(1) = Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1"...
,Name="myFault1");
myFault(2) = Simulink.fault.addFault(...
"fault_analyzer_intro/Sine Wave/Outport/1"...
,Name="myFault2");

Assign noise behavior to the fault and store the behavior in a fault model named myBehaviorModel on the path.

addBehavior(myFault(1),"myBehaviorModel",...
FaultBehavior="mwfaultlib/Add Noise");

Delete the fault, myFault1 and the behavior associated with the Sine Wave block.

Simulink.fault.deleteFault(...
"fault_analyzer_intro/Sine Wave/Outport/1","myFault1");

Input Arguments

collapse all

Path or handle of model element, specified as a string scalar, character vector, or handle. In Simulink® models, this argument must be the path or handle of a block output or input port. In Simscape™ blocks, this argument must be the path of a fault-capable model subelement. In System Composer™ models, this argument must be the path of a component output or input port.

Example: "myModel/Sine Wave/Outport/1"

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