Main Content

sbiodiff

Compare SimBiology models and diagram information

Description

example

diffResults = sbiodiff(source,target) compares two SimBiology models or SBPROJ files source and target and returns the comparison results as the SimBiology.DiffResults object diffResults. If source and target are SBPROJ files that contain more than one model, specify which model to compare using the name-value arguments SourceModelName and TargetModelName. For details on how SimBiology compares and matches model components, see SimBiology Model Matching Policy.

example

diffResults = sbiodiff(projectFile) compares two SimBiology models contained in the SBPROJ file projectFile. If the project file contains more than two models, specify which models to compare using the name-value arguments SourceModelName and TargetModelName.

example

diffResults = sbiodiff(___,Name=Value) specifies additional options using one or more name-value arguments in addition to any of the input argument combinations in the previous syntaxes.

Examples

collapse all

Load a source model.

model1      = sbmlimport("lotka");
y1          = sbioselect(model1, "Type", "species", "Name", "y1");
y1.Value    = 880;

Load a target model to compare against the source model.

model2      = sbmlimport("lotka");
y1          = sbioselect(model2, "Type", "species", "Name", "y1");
y1.Value    = 920;

Compare the models using sbiodiff and display the comparison table.

diffResults = sbiodiff(model1,model2);
diffTable   = diffResults.Comparisons
diffTable=1×6 table
           Class      Source    Target    Property    SourceValue    TargetValue
         _________    ______    ______    ________    ___________    ___________

    1    "Species"     "y1"      "y1"     "Value"       {[880]}        {[920]}  

You can also view the comparison results graphically in the Comparison tool.

visdiff(diffResults);

Get a table of model components associated with the changes reported in the comparison table.

tbl = getComponents(diffResults)
tbl=1×2 table
                  Source                      Target         
         ________________________    ________________________

    1    {1x1 SimBiology.Species}    {1x1 SimBiology.Species}

Input Arguments

collapse all

Source model to compare against the target model, specified as a SimBiology Model object or SBPROJ file name. Specify the file name as a character vector or string scalar.

If the SBPROJ file contains more than one model, specify which model to compare using the name-value argument SourceModelName.

Target model to compare against the source model, specified as a SimBiology Model object or SBPROJ file name. Specify the file name as a character vector or string scalar.

The SBPROJ file contains more than one model, specify which model to compare using the name-value argument TargetModelName.

SBPROJ file name, specified as a character vector or string scalar. The SBPROJ file must contain at least 2 models. If the file contains more than two models, specify which two models to compare using the name-value arguments SourceModelName and TargetModelName.

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: diffResults = sbiodiff("myproj.sbproj",SourceModelName="m1",TargetModelName="m2") compares two SimBiology models m1 and m2 from myproj.sbproj.

Name of the source model from the input SBPROJ file to compare, specified as a character vector or string scalar.

Data Types: char | string

Name of the target model from the input SBPROJ file to compare, specified as a character vector or string scalar.

Data Types: char | string

Output Arguments

collapse all

Results of comparison between two models, returned as a SimBiology.DiffResults object. The comparison results are the snapshot of the model state when you ran sbiodiff.

The results include differences of the diagrams if the input SBPROJ file contains diagram information or if the specified models are open in the SimBiology Model Builder app when you run the function.

Version History

Introduced in R2022a