Main Content


Owning compartment


Owner shows you the SimBiology® compartment object that owns the compartment object. In the compartment object, the Owner property shows you whether the compartment resides within another compartment. The Compartments property indicates whether other compartments reside within the compartment. You can add a compartment object using the method addcompartment.


Applies toObject: compartment
Data typeCharacter vector
Data valuesName of compartment object. Default is [].


  1. Create a model object named modelObj.

    modelObj = sbiomodel('cell');
  2. Add two compartments to the model object.

    compartmentObj1 = addcompartment(modelObj, 'nucleus');
    compartmentObj2 = addcompartment(modelObj, 'mitochondrion');
  3. Add a compartment to one of the compartment objects.

    compartmentObj3 = addcompartment(compartmentObj2, 'matrix');
  4. Display the Owner property in the compartment objects.

    get(compartmentObj3, 'Owner')

    The result shows you the owning compartment and its components:

    SimBiology Compartment - mitochondrion 
       Compartment Components:
         Capacity:          1
         Compartments:      1
         ConstantCapacity:  true
         Species:           0
  5. Change the owning compartment.

    set(compartmentObj3, 'Owner', compartmentObj1)