How to get recent n-samples using Data acquisition toolbox?

4 views (last 30 days)
Hi, I'm new to Session-Based Interface with Data Acquisition Toolbox. I'd like to make a real-time feedback system (I used NI DAQ device(USB-6002).). Using Legacy interface, we can use the command below to get recent n-samples.
data = peekdata(obj,samples)
In Session-Based Interface, I wrote a code below, but got an error like this
"On this platform, notifications more frequent than 20 times per second may not be achievable".
I'd like to get recent samples more frequently.
function func1
daqInfo = daq.getDevices;
daqVendor = daq.getVendors;
s=daq.createSession(daqVendor.ID);
addAnalogInputChannel(s,daqInfo.ID,'ai0','Voltage');
s.Rate = 16000;
s.IsContinuous = true;
lh = s.addlistener('DataAvailable',@func2);
s.NotifyWhenDataAvailableExceeds = 160;
end
function func2(src,event)
dat = data.event;
end
Is there any way to get recent n-samples more than 100 times/second(e.g. >100Hz)?
Thanks in advance.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!