Main Content

Simulink.CloneDetection.Results class

Package: Simulink.CloneDetection

Results of find clones

Since R2021a

Description

Use an object of the Simulink.CloneDetection.Results class to analyze the results of the find clone operation.

Creation

Description

The Simulink.CloneDetection.findClones function creates an object of the Simulink.CloneDetection.Results class when executed. You can use this object as the input argument of the Simulink.CloneDetection.replaceClones function.

Note

You should not write the Simulink.CloneDetection.Results object to avoid wrong execution of replace clones function.

Properties

expand all

Detected clone information, specified as a structure.

Number of CloneGroups, SimilarClones, ExactClones and PotentialReusePercentage, returned as a structure.

Number of identical clone patterns in the model, specified as a uint32 integer.

Number of similar clones in the model, specified as a uint32 integer

Number of exact clones in the model, specified as a uint32 integer.

Total number of clones in the model, specified as a uint32 integer.

Amount of reuse opportunity in percentage in the model, specified as a uint32 integer.

Subsystems that are considered as clones, specified as a structure.

Name of the clone group, specified as a character vector.

Summary of the clone group, specified as a structure with the fields:

  • ParameterDifferences — List of differences in parameters

  • Clones — Number of subsystem clones in a particular clone group

  • BlocksPerClone — Number of block elements in the clone

  • CloneType — Whether the clone is a Similar or Exact clone

  • BlockDifference — Difference in block value

List of subsystem clone names, specified as an array of character vectors.

The ExceptionLog contains the exceptions and warnings from find clones operation, specified as an array of character vectors.

Examples

collapse all

  1. This example shows how to analyze the results of find clones operation. For an example model, see ex_detect_clones.

    The find clones function stores the information in cloneResults object.

    cloneResults = Simulink.CloneDetection.findClones('ex_detect_clones')
    cloneResults = 
      Results with properties:
                Clones: [1×1 struct]
          ExceptionLog: ''
     cloneResults.Clones
      struct with fields:
    
            Summary: [1×1 struct]
        CloneGroups: [1×2 struct]

  2. To view the summary of cloneResults.

     cloneResults.Clones.Summary
      struct with fields:
    
                     CloneGroups: 2
                   SimilarClones: 5
                     ExactClones: 0
                          Clones: 5
        PotentialReusePercentage: [1×1 struct]
     cloneResults.Clones.CloneGroups
      1×2 struct array with fields:
    
        Name
        Summary
        CloneList
     cloneResults.Clones.CloneGroups(1)
      struct with fields:
    
             Name: 'Similar Clone Group 1'
          Summary: [1×1 struct]
        CloneList: {3×1 cell}

  3. To view the summary of first clone group.

     cloneResults.Clones.CloneGroups(1).Summary
      struct with fields:
    
        ParameterDifferences: [1×1 struct]
                      Clones: 3
              BlocksPerClone: 8
                   CloneType: 'Similar'
             BlockDifference: 1

Version History

Introduced in R2021a