addrule (model) - Create rule object and add to model object

Syntax

ruleObj = addrule(modelObj, 'RuleValue')
ruleObj = addrule(modelObj, 'RuleValue', 'RuleTypeValue')

ruleObj = addrule(..., 'PropertyName', PropertyValue,...)

Arguments

modelObjModel object to which to add the rule.
RuleValueEnter a character string within quotes. For example, enter the algebraic rule 'Va*Ea + Vi*Ei - K2'.
RuleTypeValueEnter 'algebraic', 'initialassignment', 'repeatedAssignment', or 'rate'. See RuleType for more information.

Description

A rule is a mathematical expression that changes the amount of a species or the value of a parameter. It also defines how species and parameters interact with one another.

ruleObj = addrule(modelObj, 'RuleValue') creates a rule object and returns the rule object (ruleObj). In the rule object, this method assigns a value ('RuleValue') to the property Rule, assigns the value 'algebraic' to the property RuleType, and assigns the model object (modelObj) to the property Parent. In the model object (modelObj), this method assigns the rule object to the property Rules.

ruleObj = addrule(modelObj, 'RuleValue', 'RuleTypeValue') in addition to the assignments above, assigns a value (RuleTypeValue) to the property RuleType. For more information on the different types of rules see RuleType.


ruleObj = addrule(..., 'PropertyName', PropertyValue,...)
defines optional properties. The property name/property value pairs can be in any format supported by the function set (for example, name-value string pairs, structures, and name-value cell array pairs).

View additional rule properties with the function get, and modify rule properties with the function set. Copy a rule object to a model with the function copyobj, or delete a rule object from a model with the function delete.

Method Summary

Methods for rule objects

copyobj (any object)Copy SimBiology® object and its children
delete (any object)Delete SimBiology® object
display (any object)Display summary of SimBiology® object

Property Summary

Properties for rule objects

ActiveIndicate object in use during simulation
AnnotationStore link to URL or file
NameSpecify name of object
NotesHTML text describing SimBiology® object
ParentIndicate parent object
Rule Specify species and parameter interactions
RuleTypeSpecify type of rule for rule object
TagSpecify label for SimBiology® object
TypeDisplay top-level SimBiology® object type
UserDataSpecify data to associate with object

Examples

Add a rule with default RuleType.

  1. Create a model object, and then add a rule object.

    modelObj = sbiomodel('cell');
    ruleObj = addrule(modelObj, '0.1*B-A')
  2. Get a list of properties for a rule object.

    get(modelObj.Rules(1)) or get(ruleObj)
        

    MATLAB displays a list of rule properties.

        Active: 1
        Annotation: ''
              Name: ''
             Notes: ''
            Parent: [1x1 SimBiology.Model]
              Rule: '0.1*B-A'
          RuleType: 'algebraic'
               Tag: ''
              Type: 'rule'
          UserData: []

Add rule with RuleType property set to rate.

  1. Create model object, then add a reaction object

    modelObj = sbiomodel ('my_model');
    reactionObj = addreaction (modelObj, 'a -> b');
  2. Add a rule which defines that the quantity of a species c. In the rule expression k is the rate constant for a -> b.

    ruleObj = addrule(modelObj, 'c = k*(a+b)')
    
  3. Change the RuleType from default ('algebraic') to 'rate'. and verify using the get command.

    set(ruleObj, 'RuleType', 'rate');
    get(ruleObj)

    MATLAB returns all the properties for the rule object.

        Active: 1
    Annotation: ''
          Name: ''
         Notes: ''
        Parent: [1x1 SimBiology.Model]
          Rule: 'c = k*(a+b)'
      RuleType: 'rate'
           Tag: ''
          Type: 'rule'
      UserData: []

See Also

copyobj, delete, sbiomodel

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS