daq process usb-6008

4 views (last 30 days)
mado on 18 Aug 2013
how to acquire data from this code to process it in another operation in realtime
% get connected devices
d = daq.getDevices
%create session
s = daq.createSession('ni')
%add analog channel s.addAnalogInputChannel('ID',channel num, 'measurement type')
s.addAnalogInputChannel('Dev1',0, 'Voltage')
% set rate of scan 4 scans/second , run for 3 seconds
v= s.Channels(1);
v.TerminalConfig = ' Differential';
v.Coupling = ' DC';
%start continuous aquisition and plot
h = s.addlistener('DataAvailable', @(src,event) plot(event.TimeStamps, event.Data/.001));
s.NotifyWhenDataAvailableExceeds = 200;

Answers (2)

Walter Roberson
Walter Roberson on 18 Aug 2013
The line
h = s.addlistener('DataAvailable', @(src,event) plot(event.TimeStamps, event.Data/.001));
creates the (anonymous) callback function that will be called when data is available; in this case the data is plotted. You would change that line to do whatever processing you needed.
Walter Roberson
Walter Roberson on 21 Aug 2013
As complete speculation: is it possible that you need channel 1 instead of channel 0 for your single ended measurement ?

Sign in to comment.

mado on 21 Aug 2013
I need to use both of channel 0 and 1 , will it make a difference ?
Walter Roberson
Walter Roberson on 21 Aug 2013
If you have checked your wiring, then I suggest you open a case with MATLAB technical support. I do not have the software or equipment to go further on this myself.

Sign in to comment.


Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by