Main Content

Clone Detector

Enable model refactorization and subsystem reuse in models by identifying and replacing clones

Since R2019b

Description

The Clone Detector is a tool that identifies and replaces clones, which are modeling patterns that have identical block types and connections. The tool identifies clones across referenced model boundaries. You can refactor your model by replacing the clones with library links or Subsystem Reference blocks, which enables you to reuse components.

The Clone Detector interface steps you through the process of identifying and refactoring clones. You can:

  • Access clone reuse percentages in the model to determine the benefits of refactoring.

  • Vary parameter tolerance to identify similar and exact clones.

  • Identify the differences in a clone from the baseline subsystem.

  • Access a log of clone detection results.

  • Use a Simulink® Test™ license to access an embedded Test Manager that allows you to verify the equivalence of the refactored model and the original model.

Clone Detector toolstrip with sections for View, Prepare, Detect, Refactor, and Verify

To identify and replace clones in the model:

  1. Open the model TimerMemoryOptimization.

    openExample('TimerMemoryOptimization')

  2. Save the model to your working folder.

  3. On the Apps tab, click Clone Detector.

  4. In the Clone Detector tab, on the View section, you can select Help pane, Properties to show the Detected Clone Properties pane, or Results to show the Clone Detection Actions and Results pane.

  5. Click Find Clones to identify clones.

  6. Click the Clone Detection Action and Results pane and browse the results to view the identified clones.

  7. Click Replace Clones to replace the clone groups. A backup model with the original layout is saved. Click the Restore button in the clone detection logs to revert to the original model.

  8. Click Check Equivalency to open the Test Manager. This tests whether the refactored model is functionally equivalent to the original model.

Clone Detector app

Open the Clone Detector App

In the Apps gallery, click Clone Detector.

Version History

Introduced in R2019b