Convert unit and unit value to new unit
sbioconvertunits(
Obj
,
'unit
')
sbioconvertunits(
converts the
current Obj
,
'unit
')*Units
property on SimBiology® object,
to
the unit, Obj
. This
function configures the unit
*Units
property to
and
updates the corresponding value property. For example, unit
sbioconverunits
on
a speciesObj
updates the InitialAmount
property
value and the InitialAmountUnits
property value.
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 Obj
InitialAmount
configured
to 1
and InitialAmountUnits
configured
to mole
, after the call to sbioconvertunits
with
specified
as unit
molecule
, speciesObj
InitialAmount
is 6.0221e23
and InitialAmountUnits
is molecule
.
Convert the units of the initial amount of glucose from molecule
to mole
.
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
Convert the InitialAmountUnits
of
glucose from molecule
to mole
.
sbioconvertunits (speciesObj, 'mole')
Verify the conversion of units and InitialAmount
value.
Units are converted from molecule to mole.
get (speciesObj, 'InitialAmountUnits') ans = mole
The InitialAmount
value is changed.
get (speciesObj, 'InitialAmount') ans = 3.8192e-023