Main Content

preload

R2026b

Queue scan data for device output

Description

preload(d,scanData) provides scan data to the DataAcquisition interface d for device output.

If the DataAcquisition interface has output channels, you can queue data using preload and then call start. Data generation then starts on the output channels in the background without blocking MATLAB®.

example

Examples

collapse all

To prepare for device output, queue scan data to the DataAcquisition interface.

Consider an interface d with an analog output channel.

d = daq("ni");
addoutput(d,"Dev1","ao1","Voltage");

Define and queue a sine wave for repeated output on a single channel.

scanData = sin(linspace(0,2*pi,5000)');
preload(d,scanData)
% ⋮

Calling start begins background generation. The interface repeats the sine wave automatically as the data output. Calling stop terminates the output generation.

start(d,"RepeatOutput")
% ⋮
stop(d)

Define and queue a cosine wave for output of one cycle on a single channel.

scanData = cos(linspace(0,2*pi,5000)');
preload(d,scanData)
% ⋮

Calling start begins data generation in the background. After the function outputs the queued data, background generation stops.

start(d)

Input Arguments

collapse all

DataAcquisition interface, specified as a DataAcquisition object, created using the daq function.

Example: d = daq(...)

Scan data for device output, specified as an M-by-N matrix, where M is the number of data scans and N is the number of output channels in the DataAcquisition object. Each column of scanData contains the data for one channel. For a single channel, the data is a column vector.

Data Types: double

Version History

Introduced in R2020a

See Also

Functions