sbiounit
Create user-defined unit
You can no longer specify an offset as an input when you call sbiounit
. Use an absolute unit that does not require an offset. For
details, see Version History.
Syntax
unitObject
= sbiounit('NameValue
')
unitObject
= sbiounit('NameValue
',
'CompositionValue
')
unitObject
= sbiounit('NameValue
','CompositionValue
',MultiplierValue
)
unitObject
= sbiounit('NameValue
','CompositionValue'
,...'PropertyName'
, PropertyValue
...)
Arguments
| Name of the user-defined unit. |
| Shows the combination of base and derived units that
defines the unit |
| Numerical value that defines the relationship between
the user-defined unit |
| Name of the unit object property, for example, |
| Value of the unit object property, for example, |
Description
constructs
a SimBiology® unit object named unitObject
= sbiounit('NameValue
')
.
Valid names must begin with a letter, and be followed by letters,
underscores, or numbers.NameValue
allows
you to specify the name and the composition of the unit.unitObject
= sbiounit('NameValue
',
'CompositionValue
')
creates
a unit with the name unitObject
= sbiounit('NameValue
','CompositionValue
',MultiplierValue
)
where
the unit is defined as NameValue
MultiplierValue*CompositionValue
.
defines
optional properties. The name-value pairs can be in any format supported
by the function unitObject
= sbiounit('NameValue
','CompositionValue'
,...'PropertyName'
, PropertyValue
...)set
.
In order to use
,
you must add it to the user-defined library with the unitObject
sbioaddtolibrary
function.
To get the unit object into the user-defined library, use the following
command:
sbioaddtolibrary(unitObject
);
unitObject
properties
with the get
command. You can modify additional
properties with the set
command. For more information
about unit object properties and methods, see Unit object.Use the sbiowhos
function to list the units
available in the user-defined library.
Examples
This example shows you how to create a user-defined unit, add it to the user-defined library, and query the library.
Create units for the rate constants of a first-order and a second-order reaction.
unitObj1 = sbiounit('firstconstant', '1/second', 1); unitObj2 = sbiounit('secondconstant', '1/molarity*second', 1);
Add the unit to the user-defined library.
sbioaddtolibrary(unitObj1); sbioaddtolibrary(unitObj2);
Query the user-defined library in the root object.
rootObj = sbioroot; rootObj.UserDefinedLibrary.Units
ans = SimBiology Unit Array Index: Library: Name: Composition: Multiplier: 1 UserDefined firstconstant 1/second 1 2 UserDefined secondconstant 1/molarity*second 1
Alternatively, use the
sbiowhos
command.sbiowhos -userdefined -unit
SimBiology UserDefined Units Index: Name: Composition: Multiplier: 1 firstconstant 1/second 1.000000 2 secondconstant 1/molarity*second 1.000000
Version History
Introduced in R2008aSee Also
sbioaddtolibrary
| sbioshowunits
| sbiounitprefix
| sbiowhos