Main Content

Simulink.CloneDetection.findClones

Find clones in a model

Description

cloneResults = Simulink.CloneDetection.findClones(model) finds and returns subsystem clones for a specified model.

cloneResults = Simulink.CloneDetection.findClones(model,cloneDetectionSettings) uses the conditions specified in a cloneDetectionSettings object for a specified model.

cloneResults = Simulink.CloneDetection.findClones(cloneDetectionSettings) uses the conditions specified in a cloneDetectionSettings object.

Examples

collapse all

This example shows how to execute findClones function and store the results to cloneResults object.

cloneResults = Simulink.CloneDetection.findClones('ex_clone_detection')

cloneResults =

  Results with properties:

    Clones: [1×1 struct]
    ExceptionLog: ''
cloneResults.Clones = 
  Results with properties:

        Summary: [1×1 struct]
    CloneGroups: [1×2 struct]

This example shows how to execute findClones function using the customised settings specified in cloneDetectionSettings object and change the value of property ParamDifferenceThreshold to zero.

cloneDetectionSettings = Simulink.CloneDetection.Settings();
cloneDetectionSettings.ParamDifferenceThreshold = 0; 

cloneResults = Simulink.CloneDetection.findClones('ex_clone_detection', cloneDetectionSettings)
cloneResults =

  Results with properties:

    Clones: [1×1 struct]
    ExceptionLog: ''

This example shows how to execute findClones function using the customised settings specified in cloneDetectionSettings object and mention the folders name in Folders property.

cloneDetectionSettings = Simulink.CloneDetection.Settings();
cloneDetectionSettings.Folders = {'Folder 1', 'Folder 2', 'Folder 3'};

cloneResults = Simulink.CloneDetection.findClones(cloneDetectionSettings)

cloneResults =

  Results with properties:

    Clones: [1×1 struct]
    ExceptionLog: ''

Input Arguments

collapse all

Model name, specified as a character vector.

Clone Detection Settings, specified as a Simulink.CloneDetection.Settings object.

Output Arguments

collapse all

Identified clones, returned as a Simulink.CloneDetection.Results object.

Introduced in R2021a