Array of compartments in model or compartment
Compartments shows you a read-only array
of SimBiology® compartment objects in the model object and the
compartment object. In the model object, the Compartments property
indicates all the compartments in a Model object
as a flat list. In the compartment object, the Compartments property
indicates other compartments that are referenced within the compartment.
The two instances of Compartments are illustrated
in Examples.
You can add a compartment object using the method addcompartment.
| Applies to | Objects: compartment, model |
| Data type | Array of compartment objects |
| Data values | Compartment object. Default is [] (empty). |
| Access | Read-only |
Create a model object named modelObj.
modelObj = sbiomodel('cell');Add two compartments to the model object.
compartmentObj1 = addcompartment(modelObj, 'nucleus'); compartmentObj2 = addcompartment(modelObj, 'mitochondrion');
Add a compartment to one of the compartment objects.
compartmentObj3 = addcompartment(compartmentObj2, 'matrix');
Display the Compartments property
in the model object.
get(modelObj, 'Compartments')
SimBiology Compartment Array Index: Name: Capacity: CapacityUnits: 1 nucleus 1 2 mitochondrion 1 3 matrix 1
Display the Compartments property
in the compartment object.
get(compartmentObj2, 'Compartments')
SimBiology Compartment - matrix
Compartment Components:
Capacity: 1
CapacityUnits:
Compartments: 0
ConstantCapacity: true
Owner: mitochondrion
Species: 0