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 model to the right 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:
Select a report item.
On the Comparison tab, in the Merge section, click Node to merge the selected 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.
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. The software attempts to connect all lines to blocks after the merge, but you may need to manually connect some blocks.
To merge individual parameters, right-click an item in the Parameters pane and select Merge Selected Parameter. Alternatively, click the Parameter button in the Merge section of the toolstrip.
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.
To merge differences in MATLAB® Function block code, click the Compare button next to the MATLAB Function block node in the report. A new text comparison opens where you can merge differences in the code.
Tip When merging MATLAB Function block code, you might want to turn off Highlight in Models, to avoid displaying the parent models each time you merge in your text comparison. See Display Items in Original Models
(Optional) To revert all merge operations, on the Comparison tab, in the Merge section, click Undo All. 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.
You must merge blocks before lines in the Simulink part of the report, and in the Stateflow® section you must merge states and junctions before merging transitions, or the report cannot make the connections.
If you want to merge subsystems, be aware that in XML text files, subsystems are represented by two nodes, the container and the contents. The two nodes have the same name but different properties, for example, name changes are a property of the container node. You can merge the container parameters and contents independently. If you want to merge a subsystem and all its properties, merge both the container and the contents nodes.
For information on merging between models with identical names, see Comparing XML Files from Models with Identical Names.