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 comentarios

What difficulty are you observing?
i'm able to get data but i want real time plot can u help me with sample code??
Where is your callback for when data is ready?
avinash pabbireddy
avinash pabbireddy el 11 de Nov. de 2013
Editada: Walter Roberson el 17 de Nov. de 2013
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;
i'm not able to see the plot
Is your plotData callback being called? If you put a disp() statement in it does the string get displayed ?
@avinash pabbireddy

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Preguntada:

el 2 de Nov. de 2013

Cerrada:

el 11 de Feb. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by