Enable model refactorization and subsystem reuse in models by identifying and replacing clones
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.
To identify and replace clones in the model:
Open the model
Save the model to your working folder.
On the Apps tab, click Clone Detector.
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.
Click Find Clones to identify clones.
Click the Clone Detection Action and Results pane and browse the results to view the identified clones.
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.
Click Check Equivalency to open the Test Manager. This tests whether the refactored model is functionally equivalent to the original model.
Open the Clone Detector App
In the Apps gallery, click Clone Detector.
Introduced in R2019b