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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by