主要内容

About金宝appModel Comparison

Creating Model Comparison Reports

In Simulink®, you can compare Simulink models. Review and merge differences using three-way model merge or two-way model merge.

You can use models from any version of Simulink. Use the comparison report to explore the differences, view the changes highlighted in the original models, and merge differences.

有关详细信息,请参阅Compare Simulink ModelsMerge Simulink Models from the Comparison Report.

您可以从:

  • matlab®Current Folder browser context menu

  • MATLAB比较工具

  • matlabcommand line

  • The Simulink EditorCompare菜单

  • The Project view

您可以将比较工具与模型文件格式,SLX和MDL一起使用。如果选定的文件是.mdl文件或保存在上一个版本中的SLX文件,然后比较工具首先导出.mdl将临时文件夹中的SLX文件文件文件,并根据SLX文件产生比较报告。

有关创建报告的更多信息,请参阅选择Simul金宝appink模型进行比较.

模型比较的示例

有关指示的示例,请参见:

有关使用的更多信息d understanding the comparison reports, seeCompare Simulink Models.

使用模型比较报告

You can display comparison reports in the Comparison Tool. In the interactive report, you can click items in the report to display the corresponding items highlighted in the original models.

The comparison report shows a hierarchical view of the portions of the two files that differ. The report does not show sections of the files that are identical.

如果文件相同,则会看到一条消息报告没有差异。

If files have not been saved, you see an error message informing you that you must save modified or newly created models before running a comparison.

Note

It might not be possible for the analysis to detect matches between previously corresponding sections of files that have diverged too much.

Change detection is based on a scoring algorithm. Items match if their score is above a threshold. The tool's algorithm uses a comparison pattern that defines the thresholds assigned to particular node types (e.g., block).

For more information on using the report, seeCompare Simulink Models.

要控制突出显示,请参见Display Differences in Original Models.

To merge differences, seeMerge Simulink Models from the Comparison Report.

For more information about the Comparison Tool, see比较文件,文件夹和合并文件.

Select金宝appModels to Compare

To learn what you can do with comparison reports, see关于Simu金宝applink模型比较.

金宝appEditor

To compare files using the Simulink Editor:

  1. On theModeling标签,在评估和管理section, selectCompare>比较模型.

    The Select Files or Folders for Comparison dialog box opens.

  2. 如果编辑器当前显示模型,则当前模型名称和路径将自动选择First file or folderedit box. Use the browse buttons to locate and select files for the first and second model files.

  3. 当您单击时Compare,比较工具执行分析,并在比较工具中显示结果报告。

从当前文件夹浏览器中选择文件

要比较当前文件夹浏览器的两个文件:

  • For two files in the same view, select two files, right-click and selectCompare Selected Files/Folders.

  • Alternatively, you can browse to select the second file to compare:

    1. 选择一个文件,右键单击并选择Compare Against

    2. Select the second file to compare in the Select Files or Folders for Comparison dialog box.

    3. 对于模型,留下默认Comparison type,Simulink Model Comparison.

    4. ClickCompare.

For more information about comparisons of other file types (e.g., text, MAT, or binary) with the Comparison Tool, see比较文件,文件夹和合并文件.

Select Files from a Project

如果您有一个使用源控件的项目,则可以从项目的修改文件视图中创建模型比较报告。有关详细信息,请参阅项目管理.

从Comparison Tool

To compare files using the Comparison Tool, from the MATLAB Toolstrip, in the文件section, select theComparebutton. In the dialog box select files to compare.

从命令行选择文件

To compare XML files from the command line, enter

Visdiff(filename1, filename2)

wherefilename1filename2是XML文件或Simulink模型金宝app。

Visdiffproduces a report in the Comparison Tool.

To create anxmlcomp.editsobject at the command line without opening the Comparison Tool, enter:

编辑= slxmlcomp.compare(modelname_a,modelname_b)
SeeExport Results to the Workspace有关有关的信息xmlcomp.edits目的。

Choose a Comparison Type

要更改比较类型,请从比较工具中创建一个新的比较,或者使用Compare Againstoption from the Current Folder browser. You can change comparison type in the Select Files or Folders for Comparison dialog box. For example, if you want the MATLAB text differences report for XML or model files, change the comparison type toText comparison在单击之前的对话框中Compare. Alternatively, see theVisdifffunction.

相关话题