在 MATLAB 中的循环内绘图 [英] Plot inside a loop in MATLAB

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

问题描述

我正在做这样的事情:

a = [1:100];
for i=1:100,
    plot([1:i], a(1:i));
end

我的问题是在循环完成之前不会显示绘图.如何在每次迭代中显示/更新绘图?

My issue is that the plot is not shown until the loop is finished. How can I show/update the plot in every iteration?

推荐答案

使用 立即抽奖

a = [1:100];
for i=1:100,
 plot([1:i], a(1:i));
 drawnow
end

或者,您可能想查看文件中的 ANYMATE交换.

Alternatively, you may want to have a look at ANYMATE from the file exchange.

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

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