Main Content

slcoverage.SFcnSelector class

Package: slcoverage

Select S-function criterion for filtering rule

Description

Specify S-function selection criteria for a filter rule.

Construction

sel = slcoverage.SFcnSelector(type,element) specifies the type of selector to use for the selected model element.

sel = slcoverage.SFcnSelector(type,element,file) creates the selector based on the specified C or C++ file.

sel = slcoverage.SFcnSelector(type,element,file,function) creates the selector based on the specified C or C++ function in the specified file.

sel = slcoverage.SFcnSelector(type,element,file,function, expression,index) creates the selector based on the specified index of the specified decision expression.

Input Arguments

expand all

Type of S-function to select, specified as one of these values:

  • slcoverage.SFcnSelectorType.SFcnName selects the specified S-function.

  • slcoverage.SFcnSelectorType.SFcnInstanceCppFileName selects the coverage data in the generated code file for this block. Use with the file argument.

  • slcoverage.SFcnSelectorType.SFcnInstanceCppFunction selects an instance of a C or C++ function. Use with the file and function arguments.

  • slcoverage.SFcnSelectorType.SFcnInstanceCppCondition selects a condition outcome of the specified code. Use with file, function, expression, and index arguments.

  • slcoverage.SFcnSelectorType.SFcnInstanceCppDecision selects a decision outcome of the specified. Use with file, function, expression, and index arguments.

Model element to select, specified as a property name of the element, its handle, or its Simulink® identifier. Use a handle or ID for selector types that select an instance. Use a property name, such as the value of a block's 'BlockType' property, to select multiple model elements.

Example: 'sldemo_lct_bus:18', 'RelationalOperator'

C or C++ file to select, specified as a character vector or string.

Example: 'myfile.c'

C or C++ function to select, specified as a character vector or string.

Example: 'counterbusFcn'

Decision expression to select, specified as a character vector or string.

Example: 'inputGElower'

Matrix position of expression to select, specified as an integer.

Example: 2

Outputs

expand all

Selector object, returned as an slcoverage.SFcnSelector object or array of slcoverage.SFcnSelector objects.

Properties

expand all

This property is read-only.

Code used to create this selector object, returned as a character vector.

This property is read-only.

Description of the selector, returned as a character vector. Simulink Coverage™ creates the description based on the selector.

This property is read-only.

Decision expression for this selector, returned as a character vector.

This property is read-only.

C or C++ file for selector, returned as a character vector or string.

This property is read-only.

C or C++ function name for this selector, returned as a character vector.

This property is read-only.

Identifier of the model element, returned as character vector of the Simulink ID, model element property, or handle. This property is empty for the slcoverage.CodeSelector class.

Selector type, returned as one of these slcoverage.SFcnSelectorType values:

  • SFcnName

  • SFcnInstanceCppFileName

  • SFcnInstanceCppFunction

  • SFcnInstanceCppCondition

  • SFcnInstanceCppDecision

Methods

allSelectorsSelectors for model or code element

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects.

Examples

collapse all

This example shows how to create an S-Function Selector.

Start by loading the model by using load_system.

load_system('slvnvdemo_covfilt');

Create an S-Function selector by using slcoverage.SFcnSelector. The first input is the selector type, slcoverage.SFcnSelectorType.SFcnName. The second input is the path to the S-Function.

sel = slcoverage.SFcnSelector(slcoverage.SFcnSelectorType.SFcnName,...
                         'slvnvdemo_covfilt/Mode Logic/ SFunction ')
sel = 

  SFcnSelector with properties:

           FileName: ''
       FunctionName: ''
               Expr: ''
        Description: 'N/A'
               Type: SFcnName
                 Id: 'slvnvdemo_covfilt:6::43'
    ConstructorCode: 'slcoverage.SFcnSelector(slcoverage.SFcnSelectorType.SFcnName, 'slvnvdemo_covfilt:6::43', )'

Introduced in R2017b