Main Content

Compare SimBiology Models

You can compare two SimBiology models and generate a list of differences between them. If the models contain diagram (graphical) information, the comparison results also include differences for the model diagrams. For details on how SimBiology compares and matches model components, see SimBiology Model Matching Policy. After comparing the models, you can also merge the differences. For details, see Merge SimBiology Models.

Compare Models Programmatically

Use sbiodiff at the command line. It returns a SimBiology.DiffResults object that contains the comparison results.

Compare Models in Comparison Tool

To view the comparison results in the Comparison tool, do one of the following:

  • At the command line, call visdiff(diffResults), where diffResults is the SimBiology.DiffResults object returned by sbiodiff.

  • At the command line, call visdiff with two SBPROJ files as inputs.

  • On the Home tab of the MATLAB® desktop, click Compare and select two SBPROJ files.

  • Select two SBPROJ files in the Current Folder panel of the MATLAB desktop. Right-click and select Compare Selected Files/Folders.

The next figure shows an example of the Comparison tool comparing two models side by side. It uses different colors to indicate the insertion, deletion, and modification of model components. The tool lists the components in the order that they appear in the corresponding model.

Comparison tool showing the differences between two models side by side

The Previous and Next buttons in the toolstrip let you step through each difference. Use the Swap Sides button to swap the Source model and Target model. Use the Models button to switch to different models if the input SBPROJ files contain multiple models. The Refresh button lets you refresh the comparison results for two models that are currently shown in the comparison tool. Use the Filter menu to customize the comparison results. The middle section of the app contains the tree of the matched model components. The bottom section shows the property values of the model components selected in the middle section.

By default, the tool hides the unchanged properties, dependent changes, and unchanged components. The Filter menu gives additional criteria to fine-tune the results. For example, you can hide the quantity-based components (compartment, species, and parameters), the expression-based components (reactions, rules, events, and observables), and graphical changes.


The dependent changes are the side effects of changing the Name, Parent, or Owner properties of a quantity component. When these properties change, they trigger changes in other components referencing the quantity component. For instance, the Reaction property of a reaction C1.S1 -> C1.S2 changes to C1.S3 -> C1.S2 when you rename the species S1 residing in a compartment C1 to S3. The app hides such dependent changes by default.

Filter menu of the tool is shown


The SimBiology comparison tool does not include annotation blocks in the comparison results.

Git Integration

You can compare different versions of SBPROJ files that you have in a Git repository from within MATLAB as shown next. For details on setting up a Git repository, see Use Git in MATLAB.

See Also

| | |

Related Topics