Main Content

Clone Detection Checks

Use the Clone Detector app to refactor a model by identifying clones and creating models that replace clones with links to subsystem blocks in a library.

Exclude subsystems and referenced models from clone detection

To save time during model development, you can limit the scope of the clone detection analysis of your model. You can use the Clone Detection Exclusion Editor under Exclude Components to exclude Subsystem and Model blocks from clone detection. To exclude a subsystem or referenced model, right-click the subsystem or referenced model and select Identify Modeling Clones > Subsystem and its contents > Add to exclusions.

After you specify the Subsystem or Model blocks to exclude, the Clone Detector App uses the exclusion information to exclude blocks during analysis. By default, the exclusion information is stored in the model SLX file. Alternately, you can store the information in an exclusion file. To use an exclusion file, in the Clone Detection Exclusion Editor dialog box, clear Store exclusions in model file. The Exclusion File field is enabled.

The Exclusion File contains the exclusion file name and location associated with the model. You can use an exclusion file with several models. However, a model can have only one exclusion file.

Unless you specify a different folder, the Clone Detection Exclusion Editor saves the exclusion files in the current folder. The default name for an exclusion file is <model_name>_exclusions.xml.

If you create an exclusion file and save your model, you attach the exclusion file to your model. Each time that you open the model, the blocks specified in the exclusion file are excluded from the analysis.

To view exclusion information for a model, right-click a Subsystem or Model block and select Identify Modeling Clones > Open Clone Detection Exclusion Editor. For each subsystem or referenced model that you exclude from detection, in the Rationale field, you can provide a reason for why you are excluding it.

You may also choose to enable Exclude library links which excludes subsystems that are external library links and Exclude inactive and commented out Regions which excludes modeling subsystems that are inactive during simulation such as variant subsystems.