Author Topic: Real time data plotting RS232 through MATLAB  (Read 31543 times)

0 Members and 1 Guest are viewing this topic.

Offline xkyveTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 1
Real time data plotting RS232 through MATLAB
« on: June 03, 2012, 09:40:17 AM »
The Matlab script is working, but I need a little help on a detail.

I am sending data from the microcontroller to the PC using UART (RS232) evey 100 ms (it can be configured). I'm sending two integer values.

The matlab script reads both values correctly and stores them in 2 vectors, one for each value read. The vectors are growing in size over time, and as they grow I want to update my plot. (Plot as two series against time).

The thing is I can update only one graph in the plot using this:
set(plotHandle, 'YData', voltage, 'XData', time);

I have tried this to update both:
plot(axesHandle,time,voltage,time,target,'LineWidth',2);

where time, voltage and target are the 3 series. And I want to plot voltage and target as two series against time.

But it is too slow re-plotting everything, I have a major delay. The "set" method works fast but only for one series against time.

This is the code if you want to look into it:
https://github.com/xkyve/mobility/blob/master/matlab/real_time_data_plot.m

Offline xkyveTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 1
Re: Real time data plotting RS232 through MATLAB
« Reply #1 on: June 05, 2012, 06:32:24 AM »
i managed to solve the problem, in case anyone will need this, the link is still the same:

https://github.com/xkyve/mobility/blob/master/matlab/real_time_data_plot.m

 


Get Your Ad Here