MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manual de usuario Pagina 373

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 408
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 372
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.
Vista de pagina 372
1 2 ... 368 369 370 371 372 373 374 375 376 377 378 ... 407 408

Comentarios a estos manuales

Sin comentarios