This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Convert unit and unit value to new unit


sbioconvertunits(Obj, 'unit')


sbioconvertunits(Obj, 'unit') converts the current *Units property on SimBiology® object, Obj to the unit, unit. This function configures the *Units property to unit and updates the corresponding value property. For example, sbioconverunits on a speciesObj updates the InitialAmount property value and the InitialAmountUnits property value.

Obj can be an array of SimBiology objects. Obj must be a SimBiology object that contains a unit property. The SimBiology objects that contain a unit property are compartment, parameter, and species objects. For example, if Obj is a species object with InitialAmount configured to 1 and InitialAmountUnits configured to mole, after the call to sbioconvertunits with unit specified as molecule, speciesObj InitialAmount is 6.0221e23 and InitialAmountUnits is molecule.


Convert the units of the initial amount of glucose from molecule to mole.

  1. Create the species 'glucose' and assign an initial amount of 23 molecule.

    At the command prompt, type:

    modelObj = sbiomodel('cell');
    compObj = addcompartment(modelObj, 'C');
    speciesObj = addspecies (compObj, 'glucose', 23, 'InitialAmountUnits', 'molecule')
    SimBiology Species Array
       Index:    Compartment:    Name:      InitialAmount:    InitialAmountUnits:
       1         C               glucose    23                molecule
  2. Convert the InitialAmountUnits of glucose from molecule to mole.

    sbioconvertunits (speciesObj, 'mole')
  3. Verify the conversion of units and InitialAmount value.

    Units are converted from molecule to mole.

    get (speciesObj, 'InitialAmountUnits')
    ans =

    The InitialAmount value is changed.

    get (speciesObj, 'InitialAmount')
    ans =

Introduced in R2006a

Was this topic helpful?