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.
Compare Models Programmatically
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.DiffResultsobject returned by
At the command line, call
visdiffwith 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.
The Previous and Next buttons in the toolstrip let you step through each difference. 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
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
C1.S1 -> C1.S2 changes to
C1.S2 when you rename the species S1 residing
in a compartment C1 to
S3. The app hides
such dependent changes by default.
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.