Main Content

Simulink.CloneDetection.Results Class

Namespace: 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.

Percentage of reuse opportunity in the model, specified as a structure with these fields:

  • Overall — Overall percentage of clones present

  • Exact — Percentage of exact clones present

  • Similar — Percentage of similar clones present

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 these 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 clones, specified as a structure with these fields:

  • Name — Clone region name

  • PatternBlocks — List of blocks that form the clone pattern

  • DataTypeMatch — Whether the inport data types of the library subsystem match inport data types of a clone in the model

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 a find clones operation. For an example model, see ex_detect_clones.

    The Simulink.CloneDetection.findClones function stores the information in cloneResults object.

    openExample('ex_detect_clones');
    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. 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. 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