Main Content

Simulink.fault.dataInportSource

Configure data source of Fault Data Inport blocks

Since R2024b

Description

dataSource = Simulink.fault.dataInportSource(blockPath) returns the data source assigned to the Fault Data Inport block, blockPath.

example

dataSource = Simulink.fault.dataInportSource(blockPath,dataSource) assigns the data source assigned to the specified Fault Data Inport block to the data source, dataSource.

Examples

collapse all

Open the faultDataInportModel model in the Example Fault Behavior with a Fault Data Inport Block example.

openExample('faultanalyzer/FaultDataInportBlockExample')

The model has one fault. Retrieve the Fault object and open the fault behavior.

myModel = "faultDataInportModel";
myFault = Simulink.fault.findFaults(myModel);
openBehavior(myFault)

The fault behavior contains one Fault Data Inport block. Get the fault behavior path and retrieve the Fault Data Inport block handle.

myBehaviorPath = getBehavior(myFault);
myBlock = Simulink.findBlocks(...
  myBehaviorPath,"BlockType","FaultDataInport");

Retrieve the data source assigned to the block.

Simulink.fault.dataInportSource(myBlock)
ans =

    'faultDataInportModel/Pulse Generator/Outport/1'
  1. Open the faultDataInportModel model in the Example Fault Behavior with a Fault Data Inport Block example.

    openExample('faultanalyzer/FaultDataInportBlockExample')
  2. The model has one fault. Retrieve the Fault object and open the fault behavior.

    myModel = "faultDataInportModel";
    myFault = Simulink.fault.findFaults(myModel);
    openBehavior(myFault)
    
  3. The fault behavior contains one Fault Data Inport block. Get the fault behavior path and retrieve the Fault Data Inport block handle.

    myBehaviorPath = getBehavior(myFault);
    myBlock = Simulink.findBlocks(...
      myBehaviorPath,"BlockType","FaultDataInport");
  4. Reassign the data source of the block to the Constant block output port.

    Simulink.fault.dataInportSource(myBlock,...
      "faultDataInportModel/Constant/Outport/1")
    ans =
    
        'faultDataInportModel/Constant/Outport/1'

Input Arguments

collapse all

Path to the Fault Data Inport block, specified as a string scalar, character vector, or handle.

Data Types: char | string | double

Data source to assign the Fault Data Inport block to, specified as a string scalar, character vector, or handle. The source must be an output port. If you specify the path as a string scalar or character vector, you must assign this argument to the path of an output port by using a syntax that the Simulink.fault.addFault function accepts.

Data Types: char | string | double

Output Arguments

collapse all

Data source path assigned to the block, returned as a character vector.

Version History

Introduced in R2024b