Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Real Time DAQ acquisition and Processing

Subject: Real Time DAQ acquisition and Processing

From: Lee Stanley

Date: 23 May, 2013 12:21:11

Message: 1 of 3

Hi,

Is there anyway to use session based DAQ to capture real time and process signal simultaneously? I managed to acquire signal continuously but is there a way to log the data as well as to process the data and plot in different plot at the same time?

Acquiring Code

s = daq.createSession('ni');
s.addAnalogInputChannel('dev2', 0:1, 'Voltage');
set(s.Channels,'Range',[-10 10]);
s.IsNotifyWhenDataAvailableExceedsAuto = true;
lh = s.addlistener('DataAvailable', @plotdata);
s.IsContinuous = true;
s.startBackground()
while s.IsRunning
    pause(0.5)
    fprintf('While loop: Scans acquired = %d\n', s.ScansAcquired)
end

Plot Data function
function plotdata(src, event)

        plot(event.TimeStamps, event.Data)
   
end

Summary: How to log the event data and time as well as to process the data at the same time to be plotted in another new plot?

Thanks.Any advice?

Cheers,
Stanley

Subject: Real Time DAQ acquisition and Processing

From: Free

Date: 4 Aug, 2013 16:02:07

Message: 2 of 3

"Lee Stanley" wrote in message <knl1jn$166$1@newscl01ah.mathworks.com>...
> Hi,
>
> Is there anyway to use session based DAQ to capture real time and process signal simultaneously? I managed to acquire signal continuously but is there a way to log the data as well as to process the data and plot in different plot at the same time?
>
> Acquiring Code
>
> s = daq.createSession('ni');
> s.addAnalogInputChannel('dev2', 0:1, 'Voltage');
> set(s.Channels,'Range',[-10 10]);
> s.IsNotifyWhenDataAvailableExceedsAuto = true;
> lh = s.addlistener('DataAvailable', @plotdata);
> s.IsContinuous = true;
> s.startBackground()
> while s.IsRunning
> pause(0.5)
> fprintf('While loop: Scans acquired = %d\n', s.ScansAcquired)
> end
>
> Plot Data function
> function plotdata(src, event)
>
> plot(event.TimeStamps, event.Data)
>
> end
>
> Summary: How to log the event data and time as well as to process the data at the same time to be plotted in another new plot?
>
> Thanks.Any advice?
>
> Cheers,
> Stanley

Hi Stanley,

same problem here. Any Solution so far?


Cheers

Subject: Real Time DAQ acquisition and Processing

From: moria

Date: 17 Jan, 2014 11:56:07

Message: 3 of 3

hello,

I am working on my school project and for that I need to aquire data from NI sampling card using session based daq. The data is a heart rate pulse signal and I want to display the signal in real time, but after filtering the signal, in my GUI. Plus I need to save the data for future use. I saw that you can log the data with the listener but then I cant seem to figure out how to plot it at the same time. I succeeded on plotting the raw signal but without the filtering.

Please someone help!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us