How to plot real time data from text file

5 次查看(过去 30 天)
Im new to matlab coding so im still trying to get my head around things. Pretty much im working with interia sensors which output the sensors orientation data every 10ms. Im able to store this data into a text file which is continuously updating.
My task now is to plot this data in real time. This involves continuously accessing and reading from the text file (every 10ms if possible) and graph this data with respect to time. Can any of you guys give me some guidance onto what would be the most effective way to do this.
The text file stores 2 sets of data (stored in separate columns in the text file) and both need to be graphed on the same plot with respect to time.
I can store this data into the text file in 2 way: Method 1: New data every 10ms. Each is stored in a new line. Method 2: I can make the text file only have the most recent piece of data (erasing previous data) Im able to use either of these methods.. whatever you guys think would be easier.
Ive tried using other 3rd party software to graph this data from the text file, but they all seemed really jumpy and couldnt read from the text file fast enough.
Thanks.
  1 个评论
Emma Donnelly
Emma Donnelly 2019-11-18
Hi Thomas,
I am facing a similar challenge. I was wondering if you might be willing to share the code you're working with?

请先登录,再进行评论。

采纳的回答

per isakson
per isakson 2014-1-8
编辑:per isakson 2014-1-8
I've spend some time with a Matlab program (Windows 7), which communicates with another program by reading and writing text files.
Some comments:
  • 10ms with plain Matlab is a challenge.
  • Does the text file contain a time stamp?
  • "Method 2" is faster and easier.
  • How to synchronize the two processes? Risk of missing data points.
  • Low level handle graphic is faster: set(axes_handle,'Ydata',y_value); etc.
  • Use the Matlab's timer
  • There are special toolboxes, e.g Instrument Control Toolbox and Data Acquisition Toolbox. I don't know whether they would help.
  • Unix or Windows might make a difference.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by