|On this page…|
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.
Tip You can only merge from left to right. If you want to merge into the other file, use Swap Sides before you start merging. Swap Sides reverts any merges already made and creates a new comparison report for the original files.
You can merge from the left model to the right model using the XML text files. 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 you want to merge.
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.
Tip Merge blocks before lines, and merge states and junctions before merging transitions. See Merging Tips.
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.
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.
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.
(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.
Inspect your merge changes in the Editor. If necessary, connect any lines that the software did not connect automatically. The comparison report does not update to show any changes you make in the Editor.
Save the model in the Editor.
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.
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 change filter settings after any merge operations, you will lose your merge changes. 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.
For information on merging between models with identical names, see Comparing XML Files from Models with Identical Names.
To merge differences in MATLAB® Function block code, create a comparison report for the parent models.
(Optional) On the View tab, turn off Highlight in Models. Otherwise the parent models display each time you merge a difference in the MATLAB Function block code text comparison. See Display Items in Original Models.
Next to the MATLAB Function block node in the XML comparison report, click the Compare button .
A new text comparison report opens.
In the text comparison report, select a difference in the code and click Merge to copy the selected difference from the left block to the right block.
After you finish merging differences, save the parent model in the Editor.