MATLAB IMAGE ACQUISITION TOOLBOX - RELEASE NOTES Guide de l'utilisateur Page 241

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 574
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 240
Creating and Executing Callback Functions
8-15
vid.StartFcn = {'mycallback'};
To specify additional parameters, include them as additional elements in the cell array.
time = datestr(now,0);
vid.StartFcn = {'mycallback',time};
The first two arguments passed to the callback function are still the video input
object (obj) and the event structure (event). Additional arguments follow these two
arguments.
Using Function Handles to Specify Callback Functions
You can specify the callback function as a function handle.
For example, this code specifies the callback function mycallback as the value of the
start event callback property StartFcn for the video input object vid.
vid.StartFcn = @mycallback;
To specify additional parameters, include the function handle and the parameters as
elements in the cell array.
time = datestr(now,0);
vid.StartFcn = {@mycallback,time};
If you are executing a local callback function from within a MATLAB file, you must
specify the callback as a function handle.
Specifying a Toolbox Function as a Callback
In addition to specifying callback functions of your own creation, you can also specify the
start, stop, or trigger toolbox functions as callbacks. For example, this code sets the
value of the stop event callback to Image Acquisition Toolbox start function.
vid.StopFcn = @start;
Disabling Callbacks
If an error occurs in the execution of the callback function, the toolbox disables the
callback and displays a message similar to the following.
start(vid)
??? Error using ==> frames_cb
Vue de la page 240
1 2 ... 236 237 238 239 240 241 242 243 244 245 246 ... 573 574

Commentaires sur ces manuels

Pas de commentaire