我正在尝试使用matlab通过以下代码绘制动画
height = 0.5;
for temp=1:1000
clf('reset');
height = 0.5-temp/1000;
annotation(gcf,'rectangle',[0.957845238095236-0.1 0.1595238095238094 0.00941666666666667 height],'FaceColor',[1 0 0]);
x = rand(1, 20);
y = rand(1, 20);
plot(x, y, '.', 'markersize', 5);
axis([0 1 0 1]);
drawnow;
end
如果我隐藏了注释代码,它运行得非常好,但是如果注释在那里,它会闪烁非常糟糕并且减慢模拟的速度非常糟糕。
答案 0 :(得分:0)
您可以注释掉clf('reset');
行以解决此问题...