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.

startForeground

Start foreground operations

Syntax

startForeground(s);
data = startForeground(s);
[data,timeStamps,triggerTime] = startForeground(s);

Description

example

startForeground(s); starts operations of the session object, s, and blocks MATLAB® command line and other code until the session operation is complete.

example

data = startForeground(s); returns the data acquired in the output parameter, data.

example

[data,timeStamps,triggerTime] = startForeground(s); returns the data acquired, timestamps relative to the time the operation is triggered, and a trigger time indicating the absolute time the operation was triggered.

Examples

collapse all

Acquire data by creating a session with an analog input channel.

s = daq.createSession('ni');
addAnalogInputChannel(s,'cDAQ1Mod1','ai0','Voltage');

Start the acquisition and save the acquired data into the variable data:

	data = startForeground(s);

Generate a signal by creating a session with an analog output channel.

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

Create and queue an output signal and start the generation:

outputSignal = linspace(-1,1,1000)';
queueOutputData(s,outputSignal);
startForeground(s);
s = daq.createSession('ni');
addAnalogInputChannel(s,'cDAQ1Mod1','ai0','Voltage');

Start the acquisition and save the acquired data in the variable data, the acquisition timestamp in timestamps, and the trigger time in triggerTime:

	[data,timestamps,triggerTime] = startForeground(s);

Input Arguments

collapse all

Data acquisition session, specified as a session object. Create the session object using daq.createSession. Use the data acquisition session for acquisition and generation operations. Create one session per vendor and use that vendor session to perform all data acquisition operations.

Output Arguments

collapse all

Values of acquired data, returned as an m-by-n array of doubles, where m is the number of scans acquired, and n is the number of input channels in the session.

Recorded timestamp relative to the time the operation is triggered, returned as an m-by-1 array, where m is the number of scans.

Timestamp of acquired data which is a MATLAB serial date timestamp representing the absolute time when timeStamps = 0.

Introduced in R2010b

Was this topic helpful?