在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?

使用或者,您可能希望查看文件中的 ANYMATE 交换.

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