This example shows how to generate signals in the background while MATLAB continues to run.
Create an NI DataAcquisition object and add an analog output voltage channel from
d = daq("ni"); addoutput(d,"cDAQ1Mod2","ao0","Voltage");
Specify the channel ID on NI devices using a terminal name, like
'ao1', or a numeric equivalent like
Create the data to output:
outputData = (linspace(-1,1,5000)');
In this case, 5000 scans will run for 5 seconds.
Queue the output data:
Start signal output generation:
You can execute other MATLAB® commands while the generation is in progress. In this example, call
pause, which causes the MATLAB command line to wait for you to press any key.