Main Content

inputSingleScan

(Not recommended) Acquire single scan from all input channels

This session object function is not recommended. Use DataAcquisition object functions instead. See Compatibility Considerations.

Description

example

data = inputSingleScan(s); returns an immediately acquired single scan from each input channel in the session as a 1-by-n array of doubles. The value is stored in data, where n is the number of input channels in the session.

Tip

To acquire more than a single scan, use startForeground.

example

[data,triggerTime] = inputSingleScan(s); returns an immediately acquired single scan from each input channel in the session as a 1-by-n array of doubles. The value is stored in data, where n is the number of input channels in the session and the MATLAB® serial date timestamp representing the time the data is acquired is returned in triggerTime.

Examples

collapse all

Acquire a single input from an analog channel.

Create a session and add two analog input channels:

s = daq.createSession('ni');
addAnalogInputChannel(s,'cDAQ1Mod1',1:2,'Voltage');

Input a single scan:

 data = inputSingleScan(s)
data =

   -0.1495    0.8643

Acquire a single input from a digital channel and get data and the trigger time of the acquisition.

Create a session and add two digital channels with InputOnly measurement type:

s = daq.createSession('ni');
addDigitalChannel(s,'dev1','Port0/Line0:1','InputOnly');

Input a single scan:

 [data,triggerTime] = inputSingleScan(s)

Acquire a single input from a counter channel.

Create a session and add a counter input channel with EdgeCount measurement type:

s = daq.createSession('ni');
addCounterInputChannel(s,'Dev1',0,'EdgeCount');

Input a single edge count:

 data = inputSingleScan(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

Value from acquired data, returned as a 1-by-n array of doubles.

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

Version History

Introduced in R2010b

collapse all

R2020a: session object interface is not recommended

Use of this function with a session object is not recommended. To access a data acquisition device, use a DataAcquisition object with its functions and properties instead.

For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.