フィルターのクリア

How do I periodically acquire data from a NI USB DAQ with a high sample rate?

2 ビュー (過去 30 日間)
Kilian
Kilian 2014 年 1 月 22 日
回答済み: Ford Creighton 2014 年 5 月 19 日
Hello
I am using an NI USB-6216 DAQ card with Matlab 2012b on Windows 7 32-bit. I am trying to sample data for 5ms at a sample rate of 100kHz periodically every 50ms, but I can't work out how to do it. Is this possible or is the latency between the the DAQ card and the PC too slow? Running a single acquisition seems to take up to 100ms, but I think running the acquisition continuously and periodically grabbing the data as required should be much faster.
I've been using the following code for a single acquisition and it works fine, but is quite slow:
ai = analoginput('nidaq','Dev2');
set(ai,'InputType','SingleEnded')
addchannel(ai,1);
ai.SampleRate = 100000;
ai.SamplesPerTrigger = 500;
%ai
tic
start(ai)
[data,time] = getdata(ai);
toc
I really appreciate any help with this.
Thanks

回答 (1 件)

Ford Creighton
Ford Creighton 2014 年 5 月 19 日
You'll need to use "addlistener" and then create a function that is called by the listener. In addition, you'll need to notify the listener when to run. Use "NotifyWhen..." (there are several notification options). Do a search for MATLAB listeners and it should point you in the right direction.

カテゴリ

Help Center および File ExchangeData Acquisition Toolbox Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by