addlistener
(Not recommended) Create event listener
This session
object function is not recommended. Use DataAcquisition
object functions instead. See Version History.
Description
creates a listener for the specified event, lh
= addlistener(s
,eventName
,@callback
)eventName
, to
execute the callback function, callback
at the time of
the event. lh
is the variable in which the listener
handle is stored. Create a callback function that executes when the listener
detects the specified event. The callback can be any MATLAB® function.
Tip
Delete the listener once the operation is complete.
delete(lh)
creates a listener for the specified event, lh
= addlistener(s
,eventName
,@(src
,event
) expr
)eventName
,
and fires an anonymous callback function. The anonymous function uses the
specified input arguments and executes the operation specified in the
expression expr
. Anonymous functions provide a quick
means of creating simple functions without storing them in a file. For more
information, see Anonymous
Functions.