Simulink XML Comparison, Including Truth Tables

This example shows you how to use Simulink® Report Generator™ to compare XML files from two Simulink models. You can view the truth table differences in a report.

This example is based upon two versions of the Stateflow® model sf_climate_control. Run the following commands to open the two example models:

open_system('slxml_climate_1')
open_system('slxml_climate_2')

Compare The XML Files

Run the following commands to compare XML files from the models.

visdiff('slxml_climate_1','slxml_climate_2')

Understand The Results

The Comparison Tool shows a report that only includes the differences between the two XML files, not the complete hierarchy of the XML files.

Colors indicate if items are modified (pink items) or unmatched (green items, found only on one side).

Stepping Through Differences

Use the "Next" and "Previous" navigation buttons on the Comparison tab to step through groups of changes in the report. When you do this to select an item:

  • The report highlights the corresponding item in the other tree (if it exists).

  • Both models display next to the report. The report highlights the corresponding item in the Simulink model, if possible.

You can control highlighting in models on the View tab.

Explore Differences in Truth Tables

Browse down the tree of differences to locate the Stateflow part of the report. Locate and click the node slxml_climate_1/ClimateController.

When you click "ClimateController", the report displays the "truth table editor" for each of the truth tables.

Look under the "tt_blk_kernel" node and find the "truthTable" node. Click the "Compare" button for each of the nodes "Condition Table" and "Action Table", to open two new instances of the Comparison Tool, displaying text comparison reports. The text comparison reports show:

  • Differing data values for the two Condition tables.

  • Changes including fixes for the typos in the Action tables.

Filtering Results

It is possible to filter the results shown in the Comparison Tool to remove items that are not of interest. To see the available filters, and whether or not they have been applied to the current report, click the Filter button on the View tab.

Some information in the Simulink XML file is defined as being "nonfunctional". These are changes that are unlikely to change the behavior of the design. Nonfunctional items are hidden by default.

Further Information

Compare Simulink Model XML FilesCompare Simulink Model XML Files

Was this topic helpful?