Main Content

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.

Simulink Three-Way Merge Tool

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

expand all

  • 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:

    1. In the Comparison toolstrip, click New Filter.

    2. Fill the Name field.

    3. In the Rules section, populate the Select, Parameter Name, and Parameter Value columns depending on the purpose of the filter.

      PurposeSet Select ColumnSet Parameter NameSet Parameter Value
      Filter out annotation changesAnnotationClick the minus button to clear the row.Leave blank
      Filter out Inport and Outport block changesBlockBlockTypeInport
      To add a row, click Add Rule, then select BlockBlockTypeOutport
      Filter out sample time parameter changesParameterSampleTimeAny
      • Filter out annotation changes.

      • Filter out Inport and Outport block changes.

      • Filter out sample time parameter changes.

Related Examples

Parameters

expand all

Navigate between conflict or manual merge in the three-way merge report.

Enabling Linked Scrolling synchronizes the scrolling between the Mine, Theirs, and Base models.

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.

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.

By default, the report shows changes to signal lines. Clear the Lines filter to simplify the report if needed.

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.

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.

Create custom filters to simplify the three-way merge report and focus on specific conflicts.

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

expand all

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

expand all

Version History

Introduced in R2016b