can anyone help me with real time data plot using ni 9234

s = daq.createSession('ni');
s.addAnalogInputChannel('cDAQ2Mod1', 0, 'Voltage');
s.addAnalogInputChannel('cDAQ2Mod1', 1, 'Voltage');
s.Rate = 2000
s.DurationInSeconds = 20;
s
[data5,time] = s.startForeground;
plot(time,data5);
xlabel('Time (secs)');
ylabel('Voltage')

7 件のコメント

Walter Roberson
Walter Roberson 2013 年 11 月 3 日
What difficulty are you observing?
avinash pabbireddy
avinash pabbireddy 2013 年 11 月 4 日
i'm able to get data but i want real time plot can u help me with sample code??
Walter Roberson
Walter Roberson 2013 年 11 月 4 日
Where is your callback for when data is ready?
avinash pabbireddy
avinash pabbireddy 2013 年 11 月 11 日
編集済み: Walter Roberson 2013 年 11 月 17 日
function nidaq9234
global data
s = daq.createSession('ni');
s.addAnalogInputChannel('cDAQ2Mod1',0,'voltage')
s.addAnalogInputChannel('cDAQ2Mod1', 1, 'Voltage');
s.Rate = 2000
s.DurationInSeconds = 20
lh = s.addlistener('DataAvailable',@plotData);
s.startBackground();
% Do something
while(~s.IsDone)
end
close(gcf);
plot(data); % plot global data
function plotData(src,event)
persistent tempData;
global data
if(isempty(tempData))
tempData = [];
end
plot(event.TimeStamps, event.Data)
tempData = [tempData;event.Data];
data = tempData;
avinash pabbireddy
avinash pabbireddy 2013 年 11 月 11 日
i'm not able to see the plot
Walter Roberson
Walter Roberson 2013 年 11 月 17 日
Is your plotData callback being called? If you put a disp() statement in it does the string get displayed ?
Walter Roberson
Walter Roberson 2014 年 3 月 11 日
@avinash pabbireddy

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2013 年 11 月 2 日

閉鎖済み:

2023 年 2 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by