This example shows you how to use Simulink® Report Generator™ to compare XML files from two Simulink models. You can view the Simulink XML differences in the resulting report.
This example shows you how to use Simulink Report Generator XML comparison to understand what has changed between two different designs. The designs are based upon the Simulink model sldemo_radar_matlab_function. The model has been modified to remove the use of "persistent" variables within the MATLAB® function and replace them with unit delay blocks. You can use the Simulink Report Generator to compare XML files from the two models and produce a report for exploring the differences. Run the following commands to open the two example models:
Run the following commands to compare XML files from the models.
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).
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.
Click to select the first instance of "MATLAB Function" in the left tree. Observe the report highlights "MATLAB Function" on both sides of the report, and the corresponding block in both the Simulink models.
Now browse down the left tree to the MATLAB Function Stateflow® chart node. Locate the pink node under this node, also named "MATLAB Function". Click the "Compare" button at the end of this node to open a new instance of the Comparison Tool comparing the two MATLAB functions. In this example you can see that the input and arguments of the function have changed, and the persistent variables have been deleted in slxml_radar_matlab_function_2.
You can choose to merge individual changes back to the original script. To do this select a difference in the report, and click the merge button on the Comparison tab. If "Always Highlight" is on, this shows the parent report. Click Compare again to return to the text comparison of the MATLAB Functions and view the merged node. If you are merging many changes in a MATLAB Function, it can be helpful to turn off highlighting in models using the View tab.
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.