go_away

Author Topic: Real time data plotting RS232 through MATLAB  (Read 2425 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

 

Related Topics

  Subject / Started by Replies Last post
5 Replies
1969 Views
Last post July 21, 2009, 07:27:55 PM
by Webbot
1 Replies
1294 Views
Last post December 03, 2008, 09:46:04 PM
by Webbot
10 Replies
2207 Views
Last post August 30, 2009, 07:37:16 AM
by Admin
2 Replies
1467 Views
Last post December 15, 2009, 07:48:17 AM
by silo_xtreme


Get Your Ad Here