SimBiology.Unit
User-defined unit
Description
The SimBiology.Unit object holds information about user-defined
units. To make a custom unit, create the unit object and add the unit to the library using the
sbioaddtolibrary function. Use the Composition
property to specify the composition of your units.
Use dot notation to query the object properties or change properties that are not
read-only. You can also use the get and set commands.
You can also customize the units in the SimBiology Model Builder app. For details, see SimBiology Model Component Libraries.
Creation
Use sbiounit to create a custom unit.
Properties
Unit composition, specified as a character vector or string scalar.
The Composition property holds the composition of a unit
object. The Composition property shows the combination of base and
derived units that defines the unit. For example, molarity is the
name of the unit and the composition is mole/liter. Base units are
the set of units used to define all unit quantity equations. Derived units are defined
using base units or mixtures of base and derived units.
Valid physical quantities for reaction rates are amount/time, mass/time, or concentration/time.
Example:
"mole/liter"
Data Types: char | string
Relationship between the defined unit and base unit, specified as a nonzero numeric scalar.
Multiplier defines such a relationship as a product between the
base unit and a numeric value (that is, a multiplier). For example, in 1 mole =
6.0221e23*molecule, the Multiplier value is
6.0221e23.
Example: 10
Data Types: double
SimBiology.Unit object name, specified as a character vector or string
scalar.
For details on requirements and recommendations for naming SimBiology® components, see Guidelines for Naming Model Components.
Data Types: char | string
Additional information that you can add for the SimBiology object, specified as a character vector or string scalar.
Data Types: char | string
This property is read-only.
Parent object, specified as a SimBiology.Model or SimBiology.KineticLaw object.
This property is read-only.
Parent object, specified as [] or root object. The default
property value is [] until you add the
SimBiology.Unit object to the library. Then the value becomes a
root object upon addition to the library.
Object label, specified as a character vector or string scalar.
Data Types: char | string
This property is read-only.
Object type, specified as 'unit'. When you create a SimBiology
object, the value of Type is automatically defined.
Data Types: char
Data to associate with the object, specified as any MATLAB array. For example, you can specify a scalar, vector, character vector, table, or structure. Use this property to store arbitrary data on an object.
The object does not use this data directly, but you can access it
using dot notation or get.
Object Functions
delete | Delete SimBiology object |
findUsages | Find out how a unit or unit prefix is used |
get | Get SimBiology object properties |
rename | Rename SimBiology model component and update expressions |
set | Set SimBiology object properties |
Examples
Create a user-defined unit called usermole, whose Composition property is molecule and Multiplier property is 6.0221e23.
unitObj = sbiounit('usermole','molecule',6.0221e23);
Add the unit to the user-defined library.
sbioaddtolibrary(unitObj);
Query the Multiplier property.
unitObj.Multiplier
ans = 6.0221e+23
Create a unit prefix peta with the exponent value of 15.
petaPrefix = sbiounitprefix("peta",15);Add the unit prefix to the library.
sbioaddtolibrary(petaPrefix);
Check that peta has been added as a user-defined unit prefix.
sbiowhos -userdefined -unitprefix
SimBiology UserDefined Unit Prefixes
Index: Name: Multiplier:
1 peta 1000000000000000
You can also use sbioshowunitprefixes or the root object.
sbioshowunitprefixes
ans = SimBiology Unit Prefix Array Index: Library: Name: Exponent: 1 BuiltIn centi -2 2 BuiltIn deci -1 3 BuiltIn deka 1 4 BuiltIn femto -15 5 BuiltIn giga 9 6 BuiltIn hecto 2 7 BuiltIn kilo 3 8 BuiltIn mega 6 9 BuiltIn micro -6 10 BuiltIn milli -3 11 BuiltIn nano -9 12 UserDefined peta 15 13 BuiltIn pico -12 14 BuiltIn tera 12
rootObj = sbioroot; rootObj.UserDefinedLibrary.UnitPrefixes
ans = SimBiology Unit Prefix Array Index: Library: Name: Exponent: 1 UserDefined peta 15
Version History
Introduced in R2008aWhen you load a model that contains duplicate names, SimBiology automatically updates those names. SimBiology disambiguates the duplicate names by adding a suffix
"_N", where N is the first positive integer that results in a unique name. If there is an existing suffix, N will be incremented from that suffix. For example, if there are two model components named x_3, the function updates one of the names to x_4. If the existing suffix has leading zeros, the function omits the zeros in the new name. For instance, if x_003 is a duplicate name, it gets renamed to x_4. However, the function assumes that names with leading zeros and without leading zeros are different. For instance, x_005 and x_5 are considered to be different names.SimBiology issues an error if multiple model components (model, compartment, species, parameter, reaction, rule, event, observable, dose, and variant) have the same name. Within a single model, these components are required to have unique names even when they are of different types with the following two exceptions:
Species in different compartments can have the same name.
Parameters can have the same name if they are scoped to different parents. Specifically, you can use the same name for a model-scoped parameter and reaction-scoped parameters, where each reaction-scoped parameter belongs to a different reaction.
For details on how to reference model component names in expressions, see Guidelines for Referencing Names in Expressions.
SimBiology issues a warning if multiple model components have the same name.
SimBiology will not allow you to have duplicate names for model components within a model.
See Also
sbiounitprefix | sbioaddtolibrary | sbiounit | SimBiology.UnitPrefix
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)