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

  • Files or Project panel — 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.

  • Source Control panel — To resolve conflicts in a Simulink model, in the Modified Files section, right-click the model file and select View Conflicts.

  • Command Window — Use the slxmlcomp.slMerge function.

Examples

expand all

To simplify the three-way merge report and focus on a subset of changes, use the Quick Filters pane. In the toolstrip, in the Filter section, click Filter.

By default, the report hides nonfunctional changes, such as repositioning of blocks, label positions, font and color settings for blocks and lines, and system print and display settings.

  1. To see all changes including the nonfunctional changes, click the filters listed next to Visible changes to clear them.

    You can reset the filters to default any time using the Reset button.

  2. You can simplify the report to show only specific model elements or parameters.

    • To show only changes to MATLAB Function blocks and model configuration sets, in the Model Element section, clear the All checkbox. Then, select the MATLAB Function and the Model Configuration Sets check boxes.

    • To show only changes related to a specific parameter, in the Parameter Name section, clear the All checkbox. Then, select the MATLAB Function and the Model Configuration Sets check boxes.

    Tip

    Use the Search fields to look for the required checkbox faster.

    You can also sort the check boxes by name or visibility using the arrow buttons next to the search fields.

    Quick Filters pane shows the mouse pointer on the arrow button next to the search field in the Model Element section.

  3. To create a filter from the current selection, click the button next to the Available Filters section. Then, specify the filter name.

    • To rename a filter, right-click the filter you want to rename and select Rename.

    • To delete a saved filter, point to the filter you want to delete and click the red cross that appears.

    • To apply a filter, click it.

      You can reset all filters to default any time using the Reset button.

  4. You can export your filters to share with others. In the Available Filters section, click the vertical ellipses and select Export. Then, select the filters you want to export and click Export.

    After sharing, another user can import the filter by selecting Import under the vertical ellipses.

Related Examples

Parameters

expand all

Navigate between conflicts and items that require user actions in the three-way merge report.

Opens the Find dialog box where you can search for items in the three-way merge report.

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

By default, the two models being compared display to the right of the comparison report, with the model corresponding to the left side of the report on top and the model corresponding to the right side appearing below. The tool highlights the currently selected comparison report node in the models in the Simulink Editor or in the model Configuration Parameters dialog box.

To control highlighting in models, clear Always Highlight and use the Highlight Now button instead.

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.

Simplify the merge report and focus on items of interest using quick filtering.

By default, the report shows only functional changes. 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. To explore all differences, including nonfunctional changes, clear the filter .

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.

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 the 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