addrule (model)
Create rule object and add to model object
Syntax
ruleObj
= addrule(modelObj
, Rule
)
ruleObj
= addrule(modelObj
, Rule
, RuleType
)
ruleObj = addrule(...,
'PropertyName
', PropertyValue
,...)
Arguments
modelObj | Model object to which
to add the rule. |
Rule | Character vector specifying the rule. For example, enter the
algebraic rule 'Va*Ea + Vi*Ei - K2' . |
RuleType | Character vector specifying the type of rule. Choices are:
For more information, see |
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.
constructs
and returns ruleObj
= addrule(modelObj
, Rule
)ruleObj
, a rule object. In ruleObj
,
the rule object, this method assigns the modelObj
input
argument to the Parent
property, assigns the Rule
input
argument to the Rule
property, and assigns 'initialAssignment'
or 'algebraic'
to
the RuleType
property. (This method assigns 'initialAssignment'
for
all assignment rules and 'algebraic'
for all other
rules.) In modelObj
, the model object
, this method assigns ruleObj
,
the rule object, to the Rules
property.
in
addition to the assignments above, assigns the ruleObj
= addrule(modelObj
, Rule
, RuleType
)RuleType
input
argument to the RuleType
property. For more information
on the types of rules, see RuleType
.
ruleObj = addrule(...,
'
defines
optional properties. The property name/property value pairs can be
in any format supported by the function PropertyName
', PropertyValue
,...)set
.
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
.
Note
If you use the addrule
method to create
an algebraic rule, rate rule, or repeated assignment rule, and the
rule expression is not continuous and differentiable, see Using Events to Address Discontinuities in Rule and Reaction Rate Expressions before
simulating your model.
Method Summary
Methods for rule objects
copyobj | Copy SimBiology object and its children |
delete | Delete SimBiology object |
display | Display summary of SimBiology object |
get | Get SimBiology object properties |
rename | Rename SimBiology model component and update expressions |
set | Set SimBiology object properties |
Property Summary
Properties for rule objects
Active | Indicate object in use during simulation |
Name | Specify name of object |
Notes | HTML text describing SimBiology object |
Parent | Indicate parent object |
Rule | Specify species and parameter interactions |
RuleType | Specify type of rule for rule object |
Tag | Specify label for SimBiology object |
Type | Display SimBiology object type |
UserData | Specify data to associate with object |
Examples
Add a rule with the default RuleType
.
Create a model object, and then add a rule object.
modelObj = sbiomodel('cell'); ruleObj = addrule(modelObj, '0.1*B-A')
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 a rule with the RuleType
property set
to rate
.
Create model object, and then add a reaction object.
modelObj = sbiomodel ('my_model'); reactionObj = addreaction (modelObj, 'a -> b');
Add a rule which defines that the quantity of a species
c
. In the rule expression,k
is the rate constant fora -> b
.ruleObj = addrule(modelObj, 'c = k*(a+b)')
Change the
RuleType
from default ('algebraic'
) to'rate'
, and verify using theget
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: []
Version History
Introduced in R2006aSee Also
model object
| copyobj
| delete
| sbiomodel