Create compartment object
compartmentObj = addcompartment(owningCompObj, 'NameValue')
compartmentObj = addcompartment(modelObj, 'NameValue', CapacityValue)
compartmentObj = addcompartment(...'PropertyName', PropertyValue...)
|owningCompObj||Compartment object that contains the newly created compartment object.|
|NameValue||Name for a compartment object. Enter a character string unique
to the model object. |
For information on naming compartments, see Name.
|CapacityValue||Capacity value for the compartment object. Enter double. Positive real number, default = 1.|
|PropertyName||Enter the name of a valid property. Valid property names are listed in Property Summary.|
|PropertyValue||Enter the value for the property specified in PropertyName. Valid property values are listed on each property reference page.|
compartmentObj = addcompartment(modelObj, 'NameValue') creates a compartment object and returns the compartment object (compartmentObj). In the compartment object, this method assigns a value (NameValue) to the property Name, and assigns the model object (modelObj) to the property Parent. In the model object, this method assigns the compartment object to the property Compartments.
compartmentObj = addcompartment(owningCompObj, 'NameValue') in addition to the above, adds the newly created compartment within a compartment object (owningCompObj), and assigns this compartment object (owningCompObj) to the Owner property of the newly created compartment object (compartmentObj). The parent model is the model that contains the owning compartment (owningCompObj).
If you define a reaction within a model object (modelObj) that does not contain any compartments, the process of adding a reaction generates a default compartment object and assigns the reaction species to the compartment. If there is more than one compartment, you must specify which compartment the species should be assigned to using the format CompartmentName.SpeciesName.
View properties for a compartment object with the get command, and modify properties for a compartment object with the set command. You can view a summary table of compartment objects in a model (modelObj) with get(modelObj, 'Compartments') or the properties of the first compartment with get(modelObj.Compartments(1)).
compartmentObj = addcompartment(...'PropertyName', PropertyValue...) defines optional properties. The property name/property value pairs can be in any format supported by the function set (for example, name-value string pairs, structures, and name-value cell array pairs). Property Summary lists the properties. The Owner property is one exception; you cannot set the Owner property in the addcompartment syntax because, addcompartment requires the owning model or compartment to be specified as the first argument and uses this information to set the Owner property. After adding a compartment, you can change the owner using the function set.
Methods for compartment objects
|addcompartment (model, compartment)||Create compartment object|
|addspecies (model, compartment)||Create species object and add to compartment object within model object|
|copyobj (any object)||Copy SimBiology object and its children|
|delete (any object)||Delete SimBiology object|
|display (any object)||Display summary of SimBiology object|
|get (any object)||Get object properties|
|rename (compartment, parameter, species, reaction)||Rename object and update expressions|
|reorder (model, compartment, kinetic law)||Reorder component lists|
|set (any object)||Set object properties|
Properties for compartment objects
|CapacityUnits||Compartment capacity units|
|Compartments||Array of compartments in model or compartment|
|ConstantCapacity||Specify variable or constant compartment capacity|
|Name||Specify name of object|
|Notes||HTML text describing SimBiology object|
|Parent||Indicate parent object|
|Species||Array of species in compartment object|
|Tag||Specify label for SimBiology object|
|Type||Display SimBiology object type|
|UserData||Specify data to associate with object|
Create a model object (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.
SimBiology Compartment Array Index: Name: Capacity: CapacityUnits: 1 nucleus 1 2 mitochondrion 1 3 matrix 1
Display the Compartments property in the compartment object.
SimBiology Compartment - matrix Compartment Components: Capacity: 1 CapacityUnits: Compartments: 0 ConstantCapacity: true Owner: mitochondrion Species: 0