Create user-defined unit
unitObject
= sbiounit('NameValue
')
unitObject
= sbiounit('NameValue
',
'CompositionValue
')
unitObject
= sbiounit('NameValue
','CompositionValue
',MultiplierValue
)
unitObject
= sbiounit('NameValue
','CompositionValue'
,MultiplierValue
,OffsetValue
)
unitObject
= sbiounit('NameValue
','CompositionValue'
,...'PropertyName'
, PropertyValue
...)
| 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 |
| Numerical value by which the unit composition is modified.
For example, |
| Name of the unit object property, for example, |
| Value of the unit object property, for example, |
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
.
creates
a unit with the specified offset. unitObject
= sbiounit('NameValue
','CompositionValue'
,MultiplierValue
,OffsetValue
)
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.
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 SimBiology UserDefined Units Index: Name: Composition: Multiplier: Offset: 1 firstconstant 1/second 1.000000 0.000000 2 secondconstant 1/molarity*second 1.000000 0.000000
Alternatively, use the sbiowhos
command.
sbiowhos -userdefined -unit SimBiology UserDefined Units Index: Name: Composition: Multiplier: Offset: 1 firstconstant 1/second 1.000000 0.000000 2 secondconstant 1/molarity*second 1.000000 0.000000
sbioaddtolibrary
| sbioshowunits
| sbiounitprefix
| sbiowhos