Simulink Three-Way Merge Tool
Resolve conflicts in Simulink models
Description
The Three-Way Merge Tool in Simulink® is an interactive tool for resolving conflicts in a Simulink model.
Conflicts in Simulink model files can occur when multiple team members work simultaneously on the same model and keeping both changes in the merged model is not possible. To resolve conflicts in model files, the Three-Way Merge Tool displays the changes made to each model with respect to the common parent model.
Using the Three-Way Merge Tool, you can:
Visualize and highlight changes in the Simulink Editor.
Choose which changes you want to keep in the merged model using the option buttons.
Open the Simulink Three-Way Merge Tool
Current Folder browser or Project Files browser — In a folder or a MATLAB® project under source control, to resolve conflicts in a Simulink model, right-click the model file and select Source Control > View Conflicts.
Command Window — Use the
slxmlcomp.slMerge
function.
Examples
Create Custom Filters
To simplify the comparison report and focus on a subset of changes, use built-in filters or create new custom filters.
To create custom filters:
In the Comparison toolstrip, click New Filter.
Fill the Name field.
In the Rules section, populate the Select, Parameter Name, and Parameter Value columns depending on the purpose of the filter.
Purpose Set Select Column Set Parameter Name Set Parameter Value Filter out annotation changes Annotation
Click the minus button to clear the row. Leave blank Filter out Inport and Outport block changes Block
BlockType
Inport
To add a row, click Add Rule, then select Block
BlockType
Outport
Filter out sample time parameter changes Parameter
SampleTime
Any
Filter out annotation changes.
Filter out Inport and Outport block changes.
Filter out sample time parameter changes.
Related Examples
Parameters
Next/Previous
— Go to next or previous conflict or manual merge
button
Navigate between conflict or manual merge in the three-way merge report.
Linked Scrolling
— Option to synchronize scrolling between panes in the report
on (default) | off
Enabling Linked Scrolling synchronizes the scrolling between the Mine, Theirs, and Base models.
Highlight Now
— Highlight currently selected report node in Simulink Editor
button
Click Highlight Now to highlight the currently selected report node in the models in the Simulink Editor or in the model Configuration Parameters dialog box.
By default, the tool opens to the right of the three-way merge report, with the model corresponding to the Theirs pane on top and the model corresponding to the Target pane below. You can choose to open and highlight changes in models from different panes by using the Top Model and Bottom Model options.
Always Highlight
— Option to always highlight differences in models
on (default) | off
By default, the tool opens to the right of the three-way merge report the model corresponding to the Theirs pane on top and the model corresponding to the Target pane below. You can choose to open and highlight changes in models from different panes by using the Top Model and Bottom Model options.
Clear Always Highlight to use the Highlight Now button and control highlighting in the models.
Lines Filter
— Built-in filter to hide changes to signal lines from three-way merge report
off (default) | on
By default, the report shows changes to signal lines. Clear the Lines filter to simplify the report if needed.
Nonfunctional Changes Filter
— Built-in filter to hide graphical and nonfunctional changes from three-way merge report
on (default) | off
By default, the report hides nonfunctional changes, such as repositioning of items, label positions, font and color settings for blocks and lines, and system print and display settings. Turn off filters to explore all differences, including nonfunctional changes.
Block Defaults Filter
— Built-in filter to hide block default parameters from three-way merge report
on (default) | off
By default, the report hides the block default parameters. Block defaults rarely change and cause longer reports when there are added or deleted blocks. Often the report is simpler when you hide block defaults.
Show Block Defaults to explore differences including block default parameters.
New Filter
— Create custom filter
button
Create custom filters to simplify the three-way merge report and focus on specific conflicts.
Accept & Close
— Accept merge resolution and close report and models
button
After you finish resolving conflicts and manually merging items that require your attention in the target file, accept the changes and close the report and the models. Clicking Accept & Close saves the target file with all your merges and marks the conflicted file resolved in the source control tool.
If you wish to save your progress and continue resolving the conflicts later, select Accept and Close > Save and Close instead.
Programmatic Use
slxmlcomp.slMerge
If you are not using source control, or if you want to choose three files to merge, then
you can open Three-Way Merge Tool using the slxmlcomp.slMerge
function.
The Three-Way Merge Tool opens to help you merge the changes in the files
baseFile
, mineFile
, and
theirsFile
into the file targetFile
. You must
specify the full path of the files you want to merge.
slxmlcomp.slMerge(baseFile,mineFile,theirsFile,targetFile);
More About
Terminology in Three-Way Merge Report
The Three-Way Merge Tool classifies the items in the report into four categories: conflict, conflicted manual merge, manual merge, and automatic merge.
The tool follows these criteria to classify the items that require your attention.
Tool can make the decision of which change to keep.
Tool cannot make a decision of which change to keep.
The user must make an informed decision.
Tool can perform the required change in the Simulink Editor.
(Option buttons appear in row.)
Automatic Conflicted Tool cannot perform the change. The user must make the change manually in the Simulink Editor.
(Option buttons do not appear in row.)
Manual merge Conflicted manual merge This table explains the different terminology that the three-way merge report uses.
Terminology Explanation Mine
Represents the current version of your model file that includes local changes, placed on the right side of the report. Theirs
Represents the version of the same model file from another user, placed on the left side of the report. Base
Represents the most recent common version of the model files, placed in the center of the report. Target
A temporary file that opens in the Target pane where you decide if you want to take changes from the Mine, Theirs, or Base file. Option buttons
Buttons next to individual rows in the target file. These buttons enable you to make choices between changes in the Mine, Theirs, or Base file. If no buttons appear next to a row, you must manually modify the files in the Simulink Editor to resolve the conflict.
Colors in Three-Way Merge Report
The Three-Way Merge Tool highlights the rows in the report according to the type of difference. This table provides a summary of the colors used in the report.
Type of report item | Color | Description |
---|---|---|
Mine | Blue | Item resolved by selecting the Mine change. |
Base | Orange | Item resolved by selecting the Base change. |
Theirs | Purple | Item resolved by selecting the Theirs change. |
Conflict or manual merge | Red | Item is not resolved yet. Item requires a manual action from the user. |
Version History
Introduced in R2016b
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)