User`s manual

Events and Callbacks
8-53
You pass additional parameters to the callback function by including both the
callback function and the parameters as elements of a cell array. For example,
to pass the MATLAB variable
time to mycallback
time = datestr(now,0);
s.BytesAvailableFcnMode = 'terminator';
s.BytesAvailableFcn = {@mycallback,time};
Alternatively, you can specify the callback function as a string in the cell array.
s.BytesAvailableFcn = {'mycallback',time};
The corresponding function header is
function mycallback(obj,event,time)
If you pass additional parameters to the callback function, then they must be
included in the function header after the two required arguments.
Note You can also specify the callback function as a string. In this case, the
callback is evaluated in the MATLAB workspace and no requirements are
made on the input arguments of the callback function.
Enabling Callback Functions After They Error
If an error occurs while an callback function is executing, then:
The callback function is automatically disabled.
A warning is displayed at the command line, indicating that the callback
function is disabled.
If you want to enable the same callback function, then you must disconnect the
object with the
fclose function. If you want to use a different callback function,
then the callback will be enabled when you configure the callback property to
the new value.