在Matlab中指定的时间间隔后绘制实时数据 [英] plotting the real time data after certain specified interval in Matlab

查看:1158
本文介绍了在Matlab中指定的时间间隔后绘制实时数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我不知道如何解决.我正在绘制从MATLAB中的温度传感器获得的实时数据.传感器软件会为每个传感器生成文本文件,并每分钟更新一次.如果要在特定时间段后更新图,该怎么办;比方说,在10或20个值之后或每5分钟之后.

I have a question that I dont know how to figure it out. I am plotting my real time data obtained from temperature sensors in MATLAB. The sensor software generates the text file for each sensor and updates it after every minute. What do I have to do if I want the plot to be updated after certain period of time; let's say after 10 or 20 values or after every 5 mins.

推荐答案

您可以使用重用Nzbuu的代码,就像下面这样

Reusing the code of Nzbuu, it would be something like the following

function ReadAndUpdate
  [X,Y] = readFile(); % Read file 
  set(h, 'XData', X, 'YData', Y) % Update line data    
end
t = timer('TimerFcn',@ReadAndUpdate, 'Period', 5*60, ...
          'ExecutionMode', 'fixedDelay')
start(t) 

在此功能被无限触发,但是您可以stop或设置条件.

Here the function is trigged infinitely but you can stop it or set a condition.

这篇关于在Matlab中指定的时间间隔后绘制实时数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆