I am trying to plot animation with matlab by the following code
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
If I hide the annotation code, it runs pretty good, but if the annotation was there, it flashes pretty bad and slow down the simulation pretty bad.
you can comment out the
clf('reset');line to solve this issue…