Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 

Examples: Using Action Properties and Functions

Examples showing how to create action functions and configure action-related properties are given below for a data-output action and a stop action.

Specifying an Action Function for an Event

This example illustrates how you can generate data-output events. As shown below, the M-file daqdoc5_4disp is executed every time the specified number of samples are output.

Initialization: Create the analog output object AO for a sound card. The installed adaptors and hardware ID's are found with daqhwinfo.

Configuration: Add two channels to AO, set the trigger to repeat four times, specify daqug4_4disp as the M-file to execute when 8000 samples are output, generate data to be queued, and queue the data with one call to putdata.

Execution: Display summary information, start AO, and pause to update command line display from daqdoc5_4disp.

Termination: Delete AO.

The daqdoc5_4disp function is given below.

Displaying Event Information with an Action Function

This example illustrates how the action function prototype allows you to easily display event information. The code below outputs five seconds of queued data to one sound card channel.

Initialization: Create the analog output object AO for a sound card. The installed adaptors and hardware ID's are found with daqhwinfo.

Configuration: Add one channel to AO, specify daqdoc5_5disp as the M-file to execute when the start, trigger, and stop events occur, generate data to be queued, and queue the data with one call to putdata.

Termination: delete AO.

The daqdoc5_5disp function is shown below.



[ Previous | Help Desk | Next ]