Data Acquisition Toolbox | ![]() ![]() |
Logging or Sending Data
While the device object is running, you can
However, before you can log or send data, a trigger must occur. You configure an analog input or analog output trigger with the TriggerType
property. All the examples presented in this section use the default TriggerType
value of Immediate
, which executes the trigger immediately after the start
function is issued. For a detailed description of triggers, refer to Configuring Analog Input Triggers or Configuring Analog Output Triggers.
Extracting Logged Data
When a trigger occurs for an analog input object, the Logging
property is automatically set to On
and data acquired from the hardware is logged to the engine or a disk file. You extract logged data from the engine with the getdata
function. For example, to extract 500 samples for each channel contained by ai
,
getdata
blocks the MATLAB command line until all the requested data is returned to the workspace. You can extract data any time after the trigger occurs.
Sending Queued Data
For analog output objects, you must queue data in the engine with the putdata
function before it can be output to the hardware. For example, to queue 8000 samples in the engine for each channel contained by the analog output object ao
ao = analogoutput('winsound'); addchannel(ao,1:2); data = sin(linspace(0,2*pi*500,8000))'; putdata(ao,[data data])
Before the queued data can be output, you must start the analog output object.
When a trigger occurs, the Sending
property is automatically set to On
and the queued data is sent to the hardware.
![]() | Starting the Device Object | Stopping the Device Object | ![]() |