Immediately acquire one analog input sample
sample = getsample(obj)
Note: You cannot use the legacy interface on 64-bit MATLAB®. See Working with the Session-Based Interface to acquire and generate data on a 64-bit MATLAB.
An analog input object.
A row vector containing one sample for each channel contained by obj.
Create the analog input object ai and add eight channels to it.
ai = analoginput('nidaq','Dev1'); ch = addchannel(ai,0:7);
The following command returns one sample for each channel.
sample = getsample(ai);
Using getsample is a good way to test your analog input configuration. Additionally:
getsample does not store samples in, or extract samples from, the data acquisition engine.
You can execute getsample at any time after channels have been added to obj.
getsample is not supported for sound cards and Dynamic Signal Acquisition and Generation (DSA) cards.
Note: Refer to the Hardware Limitations by Vendor section before you access National Instruments® devices with the NI-DAQmx adaptor simultaneously from multiple applications.