How to plot real time data from text file

5 ビュー (過去 30 日間)
Thomas
Thomas 2014 年 1 月 6 日
コメント済み: Emma Donnelly 2019 年 11 月 18 日
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 Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by