Generate Signals on Multiple Channels

This example shows how to generate data from multiple channels and multiple devices. The example generates data using channels from an NI 9263 voltage device with ID cDAQ1Mod2, and an NI 9265 current device with ID cDAQ1Mod8.

Create an NI DAtaAcquisition object and add two analog output voltage channels from cDAQ1Mod2:

d = daq("ni");
addoutput(d, "cDAQ1Mod2', 2:3, "Voltage");

Add one output current channel from cDAQ1Mod8:

addoutput(d, "cDAQ1Mod8", "ao2", "Current");

Specify the channel ID on NI devices using a terminal name, like ao1, or a numeric equivalent like 1.

Create a set of 1000 scans of data to output for all channels. Each channel output data is defined by a column in the 1000-by-3 data matrix.

outputData(:,1) = linspace(-1,1,1000)';
outputData(:,2) = linspace(-2,2,1000)';
outputData(:,3) = linspace(0,0.02,1000)';

Generate the output signals from the data matrix.


Related Topics