Select Simulink Models for XML Comparison

To learn what you can do with XML comparison reports, see About Simulink Model XML Comparison.

Select Files from the Simulink Editor

To compare files using the Simulink® Editor:

  1. Select Analysis > Compare Simulink XML Files.

    The Select Files or Folders for Comparison dialog box opens.

  2. If the Editor currently displays a model, the current model name and path appear automatically selected in the First file or folder edit box. Use the browse buttons to locate and select files for the first and second model files.

  3. When you click Compare, the XML comparison tool performs the analysis, and displays the resulting report in the Comparison Tool.

Select Files from the Current Folder Browser

To compare two files from the Current Folder browser:

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

  • To compare files in different folders:

    1. Select a file, right-click and select Compare Against

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

    3. Leave the default Comparison type, Simulink XML text comparison.

    4. Click Compare.

If the selected files are XML or model files, the XML text comparison tool performs a Chawathe analysis and displays a report in the Comparison Tool.

For more information about comparisons of other file types (e.g., text, MAT, or binary) with the Comparison Tool, see Comparing Files and Folders in the MATLAB® documentation.

Select Files from a Simulink Project

If you have a Simulink Project using source control, you can create an XML comparison report from the Modified Files view of the Simulink Project Tool. For details, see Project Management .

Select Files from the Comparison Tool

To compare files using the Comparison Tool, from the MATLAB Toolstrip, in the File section, select the Compare button. In the dialog box select files to compare.

If the selected files are XML or model files, the XML text comparison tool performs a Chawathe analysis and displays a report in the Comparison Tool.

Select Files from the Command Line

To compare XML files from the command line, enter

visdiff(filename1, filename2)

where filename1 and filename1 are XML files or Simulink models.

If the files are models, the XML comparison tool performs the comparison on the XML files. This XML comparison functionality is an extension to the MATLAB visdiff function. visdiff produces a report in the Comparison Tool.

To create an xmlcomp.Edits object at the command line without opening the Comparison Tool, enter:

Edits = slxmlcomp.compare(modelname_A,modelname_B) 

See Export Results to the Workspace for information about the xmlcomp.Edits object.

Choose a Comparison Type

If you specify two XML or model files to compare using either the Current Folder Browser or the visdiff function, then the Comparison Tool automatically performs the default comparison type. The defaults are XML text comparison for XML files and Simulink XML text comparison for model files.

To change comparison type, either create a new comparison from the Comparison Tool, or use the Compare Against option 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 to Text comparison in the dialog before clicking Compare.

Examples of XML Comparison

For examples with instructions, see:

For information on using and understanding the report and the XML comparison functionality, refer to Compare Simulink Model XML Files.

Was this topic helpful?