Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Generate Signals in the Background

This example shows how to generate signals in the background.

Create an NI session object and add an analog output 'Voltage' channel to cDAQ1Mod2:

s = daq.createSession('ni');
addAnalogOutputChannel(s,'cDAQ1Mod2', 'ao0', 'Voltage');

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

Create the data to output:

outputData = (linspace(-1, 1, 1000)');

Queue the output data:

queueOutputData(s,outputData);

Generate the signal:

startBackground(s);

You can execute other MATLAB® commands while the generation is in progress. In this example, issue a pause(), which causes the MATLAB command line to wait for you to press any key.

pause();

Related Topics

Was this topic helpful?