Main Content

merge

R2026b

Merge two or more equivalence sets into one

Since R2026b

Description

merge(targetSet,sourceSets) moves all quantities from sourceSets into targetSet. After merging, each source set and all of its supersets and subsets are deleted from the model. The subsets of targetSet are updated to include new subsets for the merged quantities. The resolved quantity of targetSet remains unchanged. Quantities from the source sets become members of targetSet. All quantities in the merged set must belong to different models and have the same type. The function throws an error if the merge would result in multiple quantities from the same model in one set.

example

targetSet = merge(targetSet,sourceSets) also returns targetSet after the merge.

Examples

collapse all

Create two separate equivalence sets for Venous Blood compartments in a PBPK model, then use merge to combine them into one.

Create a PBPK model with four organ submodels, each containing a Venous Blood compartment.

pbpkModel = sbiomodel("PBPK");

gutModel = addmodel(pbpkModel,"Gut");
gutVenous = addcompartment(gutModel,"Venous Blood",3000,Units="milliliter");

liverModel = addmodel(pbpkModel,"Liver");
liverVenous = addcompartment(liverModel,"Venous Blood",3000,Units="milliliter");

lungModel = addmodel(pbpkModel,"Lung");
lungVenous = addcompartment(lungModel,"Venous Blood",3000,Units="milliliter");

heartModel = addmodel(pbpkModel,"Heart");
heartVenous = addcompartment(heartModel,"Venous Blood",3000,Units="milliliter");

Create two separate equivalence sets: one for Gut and Liver, another for Lung and Heart.

eqSet1 = addequivalence(pbpkModel,[gutVenous,liverVenous]);
eqSet2 = addequivalence(pbpkModel,[lungVenous,heartVenous]);

Merge the two equivalence sets into one. All quantities from the second set move into the first set.

merge(eqSet1,eqSet2);
eqSet1.Quantities
ans = 
   SimBiology Compartment Array

   Index:    Name:           Value:    Units:        ParentModel:
   1         Venous Blood    3000      milliliter    Gut         
   2         Venous Blood    3000      milliliter    Liver       
   3         Venous Blood    3000      milliliter    Lung        
   4         Venous Blood    3000      milliliter    Heart       

Input Arguments

collapse all

Equivalence set to merge quantities into, specified as a SimBiology.EquivalenceSet object. After merging, this set contains all quantities from targetSet and sourceSets.

Equivalence sets to merge from, specified as a SimBiology.EquivalenceSet object or a vector of SimBiology.EquivalenceSet objects. After merging, each source set is removed from the model.

Output Arguments

collapse all

Merged equivalence set, returned as a SimBiology.EquivalenceSet object. The returned object is the same as the input targetSet.

Version History

Introduced in R2026b