MATLAB中的实时绘图 [英] Real time plot in MATLAB

查看:380
本文介绍了MATLAB中的实时绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对MATLAB很陌生,我试图展示一些计算的实时图。我有一个 N 大小的向量,我一次处理 m 值(比如 m = N / 4 ),所以我想绘制第一个 m 值,然后第二个 m <

我的方法如下:

  for i = 1:N,
...
//计算m
...
plot(m);
end;

但它无法在每个循环中更新绘图并等待所有循环完成以绘制数据。我的问题是:我应该使用另一个函数而不是 plot 或者我可以在每个循环中添加一些延迟吗?



我认为必须有一种我不知道更新情节的方式,而不是每次都重新绘制它。 解决方案

您可以添加对 DRAWNOW 的调用以强制绘图更新。请参阅参考页。请注意, DRAWNOW 会导致图形事件队列被刷新,这可能导致回调等被执行。


I'm very new to MATLAB and I was trying to display a real time plot of some calculations. I have an N sized vector and I work with m values at a time (say m = N/4), so I want to plot the first m values and then as soon as the second m values are calculated have them replace the first plot.

My approach was as follows:

for i=1:N,
  ...
  //compute m
  ...
  plot(m);
end;

but it fails to update the plot in every loop and waits for all the loops to finish to plot the data. My question is: Should I use another function instead of plot or could I add some delay in each loop?

I think there must be a way I'm not aware of for updating the plot instead of re-plotting it every time.

解决方案

You can add a call to DRAWNOW to force the plot to update. See the reference page. Note that DRAWNOW causes the graphics event queue to be flushed, which may cause callbacks etc. to be executed.

这篇关于MATLAB中的实时绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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