Got Questions? Get Answers.
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 data acquisition and display with Data Acquisition Toolbox

Subject: Real time data acquisition and display with Data Acquisition Toolbox

From: Breanna

Date: 29 Jan, 2013 18:57:06

Message: 1 of 4

Hi everyone,
I have recently come up with a Matlab program using the Data Acquisition Toolbox that will read in voltages from a force transducer(ATI) via a National Instruments box. I display a sine wave (red) and then the force is collected and plots on the screen (white) along with the sine wave. I've minimized the code running between getdata and plot, and it appears that the time between plots is about 100 ms. I've made the display rate 100 or 120 ms, and it seems to be plotting in "real time" as much as I can tell. If I run the trial for 30 seconds, however, it seems to slow down around 22 seconds or so, and then there is perceptible (around 3 seconds or so) delay.

My question is whether or not the DAQ codes can actually display real time data. I've been told that Matlab can't do this because it's a compile-as-it-goes software, however, it seems that the DAQ commands are designed to stop background processing etc... so my hope is that this will work. Also, Does anyone know how I could assess the time delay so that I could report it in a manuscript in the future?

Thanks for any help,
Bree

Subject: Real time data acquisition and display with Data Acquisition Toolbox

From: Maxim Vedenev

Date: 30 Jan, 2013 13:46:37

Message: 2 of 4

It is possible real time processing, for example my speech osciloscope in matlab
http://www.youtube.com/watch?v=jz4Rp71weYo

In real time it is need to use bufer. The delay is defined by buffer lenght. Then more buffer length then biger delay. But too small boffer will not work.

------------------------------------
Maxim Vedenev, Matlab expert
vedenev@ngs.ru
http://simulations.narod.ru/

Subject: Real time data acquisition and display with Data Acquisition Toolbox

From: Breanna

Date: 30 Jan, 2013 22:58:07

Message: 3 of 4

Maxim Vedenev <vedenev.maxim@gmail.com> wrote in message <95742a24-eca7-481d-84ab-4a7faefbeba4@googlegroups.com>...
> It is possible real time processing, for example my speech osciloscope in matlab
> http://www.youtube.com/watch?v=jz4Rp71weYo
>
> In real time it is need to use bufer. The delay is defined by buffer lenght. Then more buffer length then biger delay. But too small boffer will not work.
>
> ------------------------------------
> Maxim Vedenev, Matlab expert
> vedenev@ngs.ru
> http://simulations.narod.ru/

Hi Maxim,
I appreciate your response. I seem to have gotten the program to run with no delay using the session interface. In this case, I am sampling at 200 Hz, and the total duration is 10 seconds. I've added a listener, and it is plotting segments of 20 samples. I've pre-allocated all 20 segment plots and then I use the set function to change the color of these so that the plot function doesn't bog down the program as it displays a voltage traveling across the screen.

In this case, is my buffer 20 samples? By buffer do you mean that I need to make sure the code between different plots of 20 samples each takes less time than it takes to collect the 20 samples? If so, is there a way to test this other than to collect time stamps after each plot and difference them?

Subject: Real time data acquisition and display with Data Acquisition Toolbox

From: Nick

Date: 9 May, 2013 23:01:09

Message: 4 of 4

Bree,
Hello - I am working on a simiilar problem. I don't suppose I could appeal to your sense of charity and take a look at your code could I?

Thanks for your time,


"Breanna " <breanna.studenka@usu.edu> wrote in message <ke9622$q8e$1@newscl01ah.mathworks.com>...
> Hi everyone,
> I have recently come up with a Matlab program using the Data Acquisition Toolbox that will read in voltages from a force transducer(ATI) via a National Instruments box. I display a sine wave (red) and then the force is collected and plots on the screen (white) along with the sine wave. I've minimized the code running between getdata and plot, and it appears that the time between plots is about 100 ms. I've made the display rate 100 or 120 ms, and it seems to be plotting in "real time" as much as I can tell. If I run the trial for 30 seconds, however, it seems to slow down around 22 seconds or so, and then there is perceptible (around 3 seconds or so) delay.
>
> My question is whether or not the DAQ codes can actually display real time data. I've been told that Matlab can't do this because it's a compile-as-it-goes software, however, it seems that the DAQ commands are designed to stop background processing etc... so my hope is that this will work. Also, Does anyone know how I could assess the time delay so that I could report it in a manuscript in the future?
>
> Thanks for any help,
> Bree

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