Main Content

EventFcns

Event expression

Description

Property of the event object that defines what occurs when the event is triggered. Specify a cell array of character vectors.

EventFcns can be any MATLAB® assignment or expression that defines what is executed when the event is triggered. All EventFcn expressions are assignments of the form 'objectname = expression', where objectname is the name of a valid SimBiology® object.

For more information about how SimBiology handles events, see How Events Are Evaluated. For examples of event functions, see Specifying Event Functions.

Characteristics

Applies toObject: event
Data typeCell array of character vectors
Data valuesExpressions for EventFcn (default is an empty character vector '')
AccessRead/write

Tip

If UnitConversion is on and your model has any event, follow the recommendation below.

Non-dimensionalize any parameters used in the event Trigger if they are not already dimensionless. For example, suppose you have a trigger x > 1, where x is the species concentration in mole/liter. Non-dimensionalize x by scaling (dividing) it with a constant such as x/x0 > 1, where x0 is a parameter defined as 1.0 mole/liter. Note that x does not have to have the same unit as the constant x0, but must be dimensionally consistent with it. For example, the unit of x can be picomole/liter instead of mole/liter.

Examples

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

    modelObj = sbmlimport('oscillator');
    eventObj = addevent(modelObj, 'time>= 5', 'OpC = 200');
  2. Set the EventFcns property of the event object.

    set(eventObj, 'EventFcns', {'pA = OpA','mA = pol'});
    
  3. Get the EventFcns property.

    get(eventObj, 'EventFcns')

See Also

Event, Trigger