Main Content

Simulink.CloneDetection.getExclusions

Get list of components excluded from clone detection

Since R2025a

Description

exclusionInfo = Simulink.CloneDetection.getExclusions(modelName) returns all blocks or queries that are excluded from clone detection analysis for the model modelName.

Examples

collapse all

Get a list of components excluded from clone detection analysis.

Open the model ex_detect_clones.

openExample('ex_detect_clones')

Exclude the subsystems SS2 and SS3 in the model ex_detect_clones from clone detection analysis.

exclusionResults = Simulink.CloneDetection.addExclusions('ex_detect_clones',...
               {'ex_detect_clones/SS2','ex_detect_clones/SS3'},'Block to be removed later.')
exclusionResults =

  struct with fields:

    AddedExclusions: [1×2 struct]
    FailedExclusions: []

For more information, see Exclude Subsystem Blocks from Clone Detection Analysis.

Retrieve the exclusions from the model.

exclusionsInfo = Simulink.CloneDetection.getExclusions('ex_detect_clones')
exclusionsInfo = 

   struct with fields:

        ExcludedQueries: [0×0 struct]
         ExcludedBlocks: [1×2 struct]

exclusionsInfo is a structure with the fields ExcludedQueries and ExcludedBlocks.

View the first excluded block:

 exclusionsInfo.ExcludedBlocks(1)
ans = 

   struct with fields:

        Blockpath: 'ex_detect_clones/SS2'
        BlockType: 'Subsystem'
        Rationale: 'Block to be removed later.'

Input Arguments

collapse all

Model to retrieve exclusions from, specified as a character vector or string array.

Example: 'mymodel'

Data Types: char | string

Output Arguments

collapse all

Exclusion information, returned as a structure with these fields:

Excluded queries, returned as a structure with these fields:

FieldDescription
QueryQuery used to exclude blocks
BlocksBlocks excluded from clone analysis
RationaleRational for exclusion

Excluded blocks, returned as a structure with these fields:

FieldDescription
BlockpathPath of the block in the model
BlockTypeBlock type
RationaleRational for exclusion

Alternative Functionality

Clone Detection Exclusion Editor

You can also view exclusions by using the Clone Detection Exclusion Editor. To view exclusion information for the Simulink® model, right-click a Subsystem or Model block and select Identify Modeling Clones > Open Clone Detection Exclusion Editor. For more information, see Exclude Components from Clone Detection.

Version History

Introduced in R2025a