How to plot a real time signal with axes automatically updating
Show older comments
Hi all, i have an analog signal coming from the usb port of my PC, and i save it in Matlab using fread(serial...); i want to plot them in real time as soon as i acquire them, of course updating the time axis (seconds vs volts). How can i do this? Note that i get a sample every 100 ms! Thanks.
2 Comments
Geoff Hayes
on 14 May 2016
Alessandro - how are you reading the data from your USB port? Do you have a timer that periodically (every 100 ms) polls the port for new data? Have you created a GUI that initiates this process and will attempt to update an axes within that GUI? Please provide more context and a sample of your code so that we can get an idea of how to best fit the solution for your needs.
Alessandro Russo
on 14 May 2016
Edited: Alessandro Russo
on 14 May 2016
Accepted Answer
More Answers (1)
Shivaputra Narke
on 14 May 2016
0 votes
Hi,
Using loops is not good idea in your case.
You can use the BytesAvailableFcn callback to update the plot with new set of bytes received.
1 Comment
Alessandro Russo
on 14 May 2016
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!