主要内容

Simulink.CloneDetection.findClones

查找模型中的克隆

自 R2021a 起

说明

cloneResults = Simulink.CloneDetection.findClones(model) 查找并返回指定 model 的子系统克隆。

cloneResults = Simulink.CloneDetection.findClones(model,cloneDetectionSettings) 使用指定 modelcloneDetectionSettings 对象中指定的条件。

cloneResults = Simulink.CloneDetection.findClones(cloneDetectionSettings) 使用 cloneDetectionSettings 对象中指定的条件。

示例

全部折叠

此示例说明如何执行 findClones 函数并将结果存储到 cloneResults 对象中。有关示例模型,请参阅 ex_detect_clones

openExample('ex_detect_clones')
cloneResults = Simulink.CloneDetection.findClones('ex_detect_clones')
cloneResults =

  Results with properties:

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

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

此示例说明如何使用 cloneDetectionSettings 对象中指定的自定义设置执行 findClones 函数,并将属性 ParamDifferenceThreshold 的值更改为零。

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

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

  Results with properties:

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

此示例说明如何使用 cloneDetectionSettings 对象中指定的自定义设置执行 findClones 函数,并在 Folders 属性中指定文件夹名称。

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: ''

输入参数

全部折叠

模型名称,指定为字符向量。

克隆检测设置,指定为 Simulink.CloneDetection.Settings 对象。

输出参量

全部折叠

识别出的克隆,以 Simulink.CloneDetection.Results 对象的形式返回。

版本历史记录

在 R2021a 中推出