Skip to Main Content Skip to Search
Product Documentation

Explore the XML Comparison Report

Navigate the Simulink XML Comparison Report

The XML Comparison report shows changes only, not the entire XML text file contents. The report shows a hierarchical view of the portions of the two XML files that differ. The report does not show sections of the files that are identical.

To step through differences, use the toolbar or the Comparison menu. To move to the next or previous group of differences, either:

You can also click to select items in the hierarchical trees and observe the following display features:

Report item highlighting indicates the nature of each difference as follows:

Type of report itemHighlightingNotes
ModifiedPinkModified items are matched pairs that differ between the two files. When you select a modified item it is highlighted in a box in both trees.
Changed parameters for the selected pair are displayed in a separate Parameters panel for review. If strings are too long to display in the Parameters table, right-click and select Compare as Text to open a new comparison of the parameters.
UnmatchedGreenWhen you select an unmatched item it is highlighted in a box in one tree only.
ContainerNoneRows with no highlighting indicate a container item that contains other modified or unmatched items.

Icons indicate the category of item, for example: model, subsystem, Stateflow machine or chart, block, line, parameter, etc.

Use the toolbar buttons or the Comparison menu for the following functions:

For examples with instructions, see also Examples of XML Comparison .

Step Through Changes

If you click Next repeatedly, you can step through every group of changes in the report, in the following order:

  1. First you step through each group of changes in the left tree. When selected items have a match in the right tree then they are also highlighted.

  2. When you reach the last item in the left tree, then Next steps through the remaining unmatched items in the right tree.

  3. When you have stepped through all changes, Next returns to the beginning of the left tree.

If you click an item in the report, the Next/Previous controls will step through changes from the point you selected.

Display Items in Original Models

When you compare the XML text files exported from Simulink models, you can choose to display the corresponding items in the original models when you select report items. You can use this reverse annotation function to explore the changes in the original models. When you select an item, the report invokes reverse annotation to the original model and highlights the corresponding item in the model.

Click a report entry to view the highlighted item (or its parent) in the model:

View Changes in Model Configuration Parameters

You can use the report to explore differences in the model Configuration Parameters. If you select a Configuration Parameter item, the report displays the appropriate root node pane, if possible, of both Configuration Parameters dialog boxes.

The Parameters pane of the report displays the label text from the dialog controls (or the parameter name if it is command line only), and the parameter values. Some configuration parameters have a different hierarchy in the XML file and the dialog box. You can right-click to merge a selected parameter value in the Parameters pane.

Control Reverse Annotation

You can toggle reverse annotation on and off by clicking the Highlight toolbar button in the Comparison Tool.

By default, models display to the right of the comparison report, with the model corresponding to the left side of the report on top, and the right below. If you move or resize the models your position settings are respected by subsequent reverse annotation operations within the same session. The tool remembers your window positions.

If you want to preserve window positions across sessions, position the window, and then enter:

slxmlcomp.storeWindowPositions

This preserves the placement of any Simulink windows, Stateflow windows, and truth table windows.

To stop storing window positions and return to the defaults, enter:

slxmlcomp.clearWindowPositions

Filter Out Differences

You can use the Filter button or Comparison menu item to control display of categories of changes. Turn off filtering to view all identified changes. Categories for filtering include:

Exceptions

The report does not filter out changes to Block and System names, annotations, and Stateflow Notes as nonfunctional, even though changes to these items do not affect the outcome of simulation. The report always displays these changes to facilitate review of code changes, because they can contain important information about users' intentions.

In certain rare cases the report filters out changes that can impact the behavior of the design. By default moves are filtered as nonfunctional, but in the following cases moves can change design behavior:

To view these types of changes in the report, turn off the filter for nonfunctional changes.

Merge Simulink Models From the Comparison Report

You can merge Simulink models from the XML text comparison report. You can merge individual parameters, blocks or entire subsystems.

The merge feature enables you to merge two versions of a design modeled in Simulink. You can merge from the left (or base) model to the right (or edited) model using the XML text files. Use swap sides if necessary. You can click Undo to revert all merge operations. You can merge modified, added or deleted nodes in the report as follows:

  1. Select a report item and click the Merge Node toolbar button , or select Comparison > Merge Node. Merge is disabled when you cannot merge the selected node. For example, you cannot merge the top level model nodes, data nodes, or nodes within configuration settings.

  2. View the results in the report and the models.

    The report merges the selected node from the left side of the report to the right. Merged report nodes have gray row highlighting, and a green merge arrow if the node has an icon, e.g., .

    The merge copies the change (a modified, added or deleted item) from the left model to the right model. If the node exists only in the left tree, then the merge inserts it into the right tree. Simulink Report Generator attempts to connect all lines to blocks after the merge, but you may need to manually connect some blocks.

  3. To merge individual parameters, right-click an item in the Parameters pane and select Merge Selected Parameter.

    You cannot insert or delete parameters, and not all parameters can be merged. For example, you cannot merge Simulink Identifier (SID) parameters. You can merge parameters that have changed from the default (only found on one side of the report), as long as the parameter exists in both blocks and is writeable. See Changes to Parameter Defaults Appear As New Parameters.

    If you merge all possible parameters for a node then the report marks that node as merged, e.g., . If you partially merge some parameters of a node, the report marks the node as partially merged with a green merge arrow icon and no gray row highlighting.

  4. (Optional) To revert all merge operations, click the Undo Merge Operations toolbar button or select Edit > Undo. A dialog prompts you to confirm you want to throw away all merge operations and revert the report and models to their original state.

    You will lose your merge changes if you change filter settings after any merge operations. A dialog prompts you to confirm you want to throw away all merge operations and revert the report and models to their original state. If you click Yes to continue, the Chawathe analysis runs again and you see a new report with the new filtering applied.

Understand the Report

To understand the report, it is helpful to understand how the Chawathe results from the exported XML text files relate to the original models. Some special features of the report include:

Unexpected Results

If you see unexpected results within an XML comparison report, see How the Matching Algorithm Works in the MATLAB Report Generator documentation.

If you cannot see changes you expected to see in the report, click the Filter button to turn off filters and see all identified changes. See Filter Out Differences.

Changes to Parameter Defaults Appear As New Parameters.  If you change a block parameter value from the default, you only see the new parameter in the report. Use reverse annotation to view both blocks. You see only the new parameter in the report because Simulink adds new parameters when the value of that parameter differs from the default. For example, rotating a block adds a new "rotated" parameter.

Work with Referenced Models and Library Links

The XML comparison report applies only to the currently selected models, and does not include changes to any referenced models or linked libraries. For compatibility with source control and peer review workflows, the comparison report shows only changes in the files selected for comparison.

If you want to examine your whole hierarchy instead, try using a Simulink Project, where you can examine modified files and dependencies across your whole project, and compare to selected revisions. See Managing Projects in the Simulink documentation.

If you are creating an XML comparison report for models that contain referenced models, and you have more than one referenced model with the same name, then your MATLAB path can affect the results. For example, this can happen if you generate an XML comparison report for the current version of your model and a previous baseline. To avoid seeing unexpected changes in model reference blocks, make sure that your referenced models are not on your MATLAB path before you generate the report.

The reason why results can change is that Simulink records information in the top model about the interface between the top model and the child model. This interface information in the top model enables incremental loading and diagnostic checks without any need to load child models.

When you load a model (for example, to export it to XML) then Simulink refreshes the interface information for referenced models if it can find the child model. Simulink can locate the child model if it is on the path. If another model of the same name is higher on the path, Simulink updates the interface information for that other model before exporting to XML. This can produce entries for model reference blocks in the comparison report that you did not expect. If you make sure your referenced models are not on your path before you generate the report, then you can avoid these unexpected results. If both model versions are off the path, the interface information in the top model is not refreshed during the exporting to XML process. Instead the cached information is used, resulting in a valid XML comparison report.

With library links, Simulink does not update the cached interface information when exporting to XML, and so the report correctly captures library interfaces. However with both referenced models and library links, Simulink updates the information when displaying the model. When displaying report items in original models, you may see unexpected results because Simulink may find a model or library that is higher in the path. To obtain the clearest results, make sure that the models and associated libraries are temporarily removed from the path. By removing the files from the path you will see unresolved library links and referenced models when you view the original models, but their interfaces will be correct and will correctly align with the comparison report.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS