Main Content

cancelTimer

Class: matlab.DiscreteEventSystem
Namespace: matlab

Cancel previously scheduled timer event

Syntax

event=cancelTimer(tag)

Description

event=cancelTimer(tag) cancels a previously scheduled timer event of the current entity. You can commit the cancellation by returning it as the output argument when implementing an event action method, such as entry.

Input Arguments

expand all

Tag of the to-be-cancelled timer event.

Output Arguments

expand all

Event for cancelling the specified timer.

Examples

expand all

Cancel a previously scheduled timer event of the entity in the current event action context.

function [entity,event] = entry(obj,storage,entity,src)
    % Cancel a previously scheduled timer event of the entity in
    % current event action context. The event was scheduled with a
    % custom tag 'timeout'.
    event = obj.cancelTimer('timeout');
end    

Version History

Introduced in R2016a