addevent (model) - Add event object to model object

Syntax

eventObj = addevent(modelObj, 'TriggerValue', 'EventFcnsValue')

eventObj = addevent(...'PropertyName', PropertyValue...)

Arguments

modelObjModel object.
TriggerValueRequired property to specify a trigger condition. Must be a MATLAB expression that evaluates to a logical value. Use the keyword 'time' to specify that an event occurs at a specific time during the simulation. See Trigger, for more information.
EventFcnsValueA string or a cell array of strings, each of which specifies an assignment of the form 'objectname = expression', where objectname is the name of a valid object. Defines what occurs when the event is triggered. See EventFcns, for more information.
PropertyNameProperty name for an Event object from the table below.
PropertyValueProperty value. For more information on property values see the property reference for each property listed in the Property Summary.

Description

eventObj = addevent(modelObj, 'TriggerValue', 'EventFcnsValue') creates an event object (eventObj) adds the event to the model (modelObj). In the event object, this method assigns a value (TriggerValue) to the property TriggerCondition, assigns a value (EventFcnsValue) to the property EventFcns, and assigns the model object (modelObj) to the property Parent. In the model object, this method appends the event object to the property Events.

When the trigger expression, in the property Trigger, changes from false to true the assignments in EventFcns are executed during simulation.

For details on how events are handled during a simulation, see Events in the SimBiology® User's Guide.


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

You can view additional object properties with the get command. You can modify additional object properties with the set command. To view events of a model object (modelObj) use the command get(modelObj, 'Events').

Method Summary

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

Property Summary

ActiveIndicate object in use during simulation
AnnotationStore link to URL or file
EventFcnsEvent expression
NameSpecify name of object
NotesHTML text describing SimBiology® object
ParentIndicate parent object
TagSpecify label for SimBiology® object
TriggerEvent trigger
TypeDisplay top-level SimBiology® object type
UserDataSpecify data to associate with object

Examples

  1. Create a model object, and then add an event object.

    modelObj = sbmlimport('oscillator')
    eventObj = addevent(modelObj, 'time>= 5', 'OpC = 200');
  2. Get a list of properties for an event object.

    get(modelObj.Events(1));
    

    Or,

    get(eventObj)

    MATLAB® displays a list of event properties.

                Active: 1
            Annotation: ''
             EventFcns: {'OpC = 200'}
                  Name: ''
                 Notes: ''
                Parent: [1x1 SimBiology.Model]
                   Tag: ''
               Trigger: 'time >= 5'
                  Type: 'event'
              UserData: []

See Also

Event object

  


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