Main Content


Get model components associated with SimBiology model comparison results

Since R2022a



tbl = getComponents(diffResults) returns a table of model components associated with the comparison results diffResults, a SimBiology.DiffResults object. Specifically, the function returns the model components listed in the diffResults.Comparisons table.

tbl = getComponents(diffResults,rowIdx) specifies a vector of row indices rowIdx to return the model components associated with the requested rows from the diffResults.Comparisons table.


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.


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    {1×1 SimBiology.Species}    {1×1 SimBiology.Species}

Input Arguments

collapse all

Model comparison results, specified as a SimBiology.DiffResults object. Use sbiodiff to generate this object.

Row indices for the diffResults.Comparisons table, specified as a vector of positive integers.

Example: [2 5 10]

Data Types: double

Output Arguments

collapse all

Model components from the comparison results, returned as a table.

The table has two columns Source and Target. Each column is a cell array and contains the model components that were changed between the source and target models. If a component was inserted or deleted, then the value of the corresponding entry in the Source or Target column is <missing>. Changes made to the components in this table do not affect the components reported in the diffResults.Comparisons table.

Version History

Introduced in R2022a