Contenuto principale

SimBiology.UnitPrefix

Hold information about user-defined unit prefix

Description

The SimBiology.UnitPrefix object contains information about user-defined unit prefixes. Use the object property Exponent to specify the exponent of your unit prefix.

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. findUsages lets you find out how a unit prefix is used in the built-in and custom libraries.

The SimBiology Model Builder app also enables you to change unit prefixes present in the libraries. For more information, see SimBiology Model Component Libraries.

Creation

Create a UnitPrefix object using sbiounitprefix and add the object to the library using sbioaddtolibrary.

Properties

expand all

Exponent value of a unit prefix, specified as a nonnegative integer.

The property defines the numerical (exponent) value of the unit prefix. You can use the unit prefix in conjunction with any built-in or user-defined units. For example, you can define a unit prefix object petaPrefix with the Exponent property value set to 15.

Data Types: double

SimBiology.UnitPrefix 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 [] or root object. The default property value is [] until you add the UnitPrefix 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 'unitprefix'. 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

deleteDelete SimBiology object
findUsagesFind out how a unit or unit prefix is used
getGet SimBiology object properties
renameRename SimBiology model component and update expressions
setSet SimBiology object properties

Examples

collapse all

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       

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

Version History

Introduced in R2008a

expand all