Data Acquisition Toolbox    

Recording and Retrieving Event Information

While the analog output object is running, certain information is automatically recorded in the EventLog property for some of the event types listed in the preceding section. EventLog is a structure that contains two fields: Type and Data. The Type field contains the event type. The Data field contains event-specific information. Events are recorded in the order in which they occur. The first EventLog entry reflects the first event recorded, the second EventLog entry reflects the second event recorded, and so on.

The event types recorded in EventLog for analog output objects, as well as the values for the Type and Data fields, are given below.

Table 6-10: Analog Output Event Information Stored in EventLog  
Event Type
Type Field Value
Data Field Value
Run-time error
Error
AbsTime
RelSample
String
Start
Start
AbsTime
RelSample
Stop
Stop
AbsTime
RelSample
Trigger
Trigger
AbsTime
RelSample

Samples output events and timer events are not stored in EventLog.

The Data field values are described below.

The AbsTime Field.   AbsTime is used by all analog output events stored in EventLog to indicate the absolute time the event occurred. The absolute time is returned using the MATLAB clock format.

The RelSample Field.   RelSample is used by all events stored in EventLog to indicate the sample number that was output when the event occurred. RelSample is 0 for the start event and for the first trigger event regardless of the trigger type. RelSample is NaN for any event that occurs before the trigger executes.

The String Field.   String is used by the run-time error event to store the descriptive message that is generated when a run-time error occurs. This message is also displayed at the MATLAB command line.

Example: Retrieving Event Information

Suppose you want to examine the events logged for the example given by Example: Queuing Data with putdata. You can do this by accessing the EventLog property.

By examining the contents of the Type field, you can list the events that were recorded while AO was running.

To display information about the trigger event, you must access the Data field, which stores the absolute time the trigger occurred and the number of samples output when the trigger occurred.

You can display a summary of the event log with the showdaqevents function. For example, to display a summary of the second event contained by the structure events:

Alternatively, you can display event summary information via the Workspace browser by right-clicking the device object and selecting Explore -> Show DAQ Events from the context menu.


  Event Types Examples: Using Callback Properties and Callback Functions