daq process usb-6008
조회 수: 2 (최근 30일)
이전 댓글 표시
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
s.Rate=1000;
s.DurationInSeconds=30;
v= s.Channels(1);
set(v)
%_____________________________
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;
s.startBackground()
댓글 수: 0
답변 (2개)
Walter Roberson
2013년 8월 18일
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.
댓글 수: 17
Walter Roberson
2013년 8월 21일
As complete speculation: is it possible that you need channel 1 instead of channel 0 for your single ended measurement ?
mado
2013년 8월 21일
댓글 수: 3
Walter Roberson
2013년 8월 21일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 National Instruments Frame Grabbers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!