Data Acquisition Toolbox | ![]() ![]() |
Outputting Data
After you configure the analog output object, you can output data. Outputting data involves these three steps:
Queuing Data in the Engine
Before you can start the device object, data must be queued in the engine. Data is queued in the engine with the putdata
function. For example, to queue one second of data for each channel contained by the analog output object ao
:
ao = analogoutput('winsound'); addchannel(ao,1:2); data = sin(linspace(0,2*pi,8000))'; putdata(ao,[data data])
putdata
is a blocking function, and will not return execution control to MATLAB until the specified data is queued. putdata
is described in detail in Managing Output Data and in Function Reference.
Starting the Analog Output Object
You start an analog output object with the start
function. For example, to start the analog output object ao
:
After start
is issued, the Running
property is automatically set to On
, and both the device object and hardware device execute according to the configured and default property values. While the device object is running, you can continue to queue data.
However, running does not necessarily mean that data is being output from the engine to the analog output hardware. For that to occur, a trigger must execute. When the trigger executes, the Sending
property is automatically set to On
. Analog output triggers are described on Defining a Trigger and Configuring Analog Output Triggers.
Stopping the Analog Output Object
An analog output object can stop under one of these conditions:
stop
function.
When the device object stops, the Running
and Sending
properties are automatically set to Off
. At this point, you can reconfigure the device object or immediately queue more data, and issue another start
command using the current configuration.
![]() | Configuring Analog Output Properties | Analog Output Examples | ![]() |