Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple real time plots in matlab

Status
Not open for further replies.

MatJoy79

Computer
Apr 7, 2016
4
0
0
DE
Hello all, greetings. I´m a beginner in Matlab. I want to plot real time graphs on matlab for 4 motors, the data being read from the serial port. The data from the serial port will contain certain parameters that I should extract and compute and plot graphs in real time. My front screen will have buttons for 4 motors. When i click on m1, it should display live graphs (read from the the serial port) and when i click on m2, the corresponding data for m2 needs to be plotted, simultaneous to m1 graphs on another figure. Is this possible? If yes, please give me an basic algorithm to follow. I can catch up from there.
I appreciate any kind of help. Thanks a lot!
 
Replies continue below

Recommended for you

Hello Mr.Locock, I have just started with the GUI layout of various figures and random plots. So when i click on the buttons/drop down menu, I get redirected to the different figures with random plots on it.

Im stuck now and do not know how to proceed as I do not have the serial data coming in. I am trying to display some sample data(not real time) instead of random plots.

Thanks and Regards
MJ
 
Yeah, get the data in first, then consider the display. The key to real time plotting is the notion of object oriented programming. You don't want to or need to create the whole set of plot figures each time. You only need to update the YData values if you plan your project correclty. No need to change titles, labels, axes or XData values. Just alter the minimum plot objects. Then its a cinch.
 
Thank you both. I guess I have started it wrong then. Since I had no hardware then , I started off with playing with GUI on Matlab. Guess I must re-design the approach. Will do that and get back in touch when in need. Thank you!
 
Hi all, so the word is that I have to use UDP object to stream in the data and display multiple plots as and when the data comes in. I have created a udp object in matlab in one pc and I have a 'packet sender' UDP test utility installed on another computer. I am able to send data from matlab to the udp test tool in the other pc, but not vice versa! Reason being : I have no infinite loop waiting for data to come in, in the matlab code. Please help me with this! If i set up an infinite loop to keep the udp interface open all the time to read data , how will i plot it? how do i do all simultaneously : read udp data, display multiple figures with multiple plots? Kindly help. Thanks a ton.
 
Status
Not open for further replies.
Back
Top