Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

sbiounit

Create user-defined unit

Syntax

unitObject = sbiounit('NameValue')
unitObject = sbiounit('NameValue', 'CompositionValue')
unitObject = sbiounit('NameValue','CompositionValue',MultiplierValue)
unitObject = sbiounit('NameValue','CompositionValue',MultiplierValue,OffsetValue)
unitObject = sbiounit('NameValue','CompositionValue',...'PropertyName', PropertyValue...)

Arguments

NameValue

Name of the user-defined unit. NameValue must begin with characters and can contain characters, underscores, or numbers. NameValue can be any valid MATLAB® variable name.

CompositionValue

Shows the combination of base and derived units that defines the unit NameValue. For example molarity 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.

MultiplierValue

Numerical value that defines the relationship between the user-defined unit NameValue and the base unit as a product of the MultiplierValue and the base unit. For example, 1 mole is 6.0221e23*molecule. The MultiplierValue is 6.0221e23.

OffsetValue

Numerical value by which the unit composition is modified. For example, °Celsius = (5/9)*(°Fahrenheit-32); °Fahrenheit is Composition; MultiplierValue is 5/9 and OffsetValue is –32.

PropertyName

Name of the unit object property, for example,'Notes'.

PropertyValue

Value of the unit object property, for example, 'New unit for GPCR model'.

Description

unitObject = sbiounit('NameValue') constructs a SimBiology® unit object named NameValue. Valid names must begin with a letter, and be followed by letters, underscores, or numbers.

unitObject = sbiounit('NameValue', 'CompositionValue') allows you to specify the name and the composition of the unit.

unitObject = sbiounit('NameValue','CompositionValue',MultiplierValue) creates a unit with the name NameValue where the unit is defined as MultiplierValue*CompositionValue.

unitObject = sbiounit('NameValue','CompositionValue',MultiplierValue,OffsetValue) creates a unit with the specified offset.

unitObject = sbiounit('NameValue','CompositionValue',...'PropertyName', PropertyValue...) defines optional properties. The name-value pairs can be in any format supported by the function set.

In order to use unitObject, you must add it to the user-defined library with the sbioaddtolibrary function. To get the unit object into the user-defined library, use the following command:

sbioaddtolibrary(unitObject);
You can view additional 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.

  1. 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); 
  2. Add the unit to the user-defined library.

    sbioaddtolibrary(unitObj1);
    sbioaddtolibrary(unitObj2);
    

  3. 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  

Introduced in R2008a

Was this topic helpful?