Why gets imellipse slower and slower in a loop?

Dear all,
I use the function imellipse in a loop and I noticed that by each iteration it gets slower and slower. For instance, when I run this code:
for k = 1 : 100
tic
ellipse = imellipse(gca, [50 50 40 40]);
toc
end
I can clearly see that the imellipse function needs more and more time:
Elapsed time is 0.280512 seconds.
Elapsed time is 0.034199 seconds.
Elapsed time is 0.029627 seconds.
Elapsed time is 0.035450 seconds.
Elapsed time is 0.042270 seconds.
Elapsed time is 0.048665 seconds.
Elapsed time is 0.054300 seconds.
Elapsed time is 0.060866 seconds.
Elapsed time is 0.067610 seconds.
Elapsed time is 0.077593 seconds.
Elapsed time is 0.080110 seconds.
Elapsed time is 0.087218 seconds.
Elapsed time is 0.093163 seconds.
Elapsed time is 0.099628 seconds.
Elapsed time is 0.106753 seconds.
Elapsed time is 0.113405 seconds.
Elapsed time is 0.119147 seconds.
Elapsed time is 0.125716 seconds.
Elapsed time is 0.132185 seconds.
Elapsed time is 0.137610 seconds.
Elapsed time is 0.159254 seconds.
Elapsed time is 0.151401 seconds.
Elapsed time is 0.157143 seconds.
Elapsed time is 0.166217 seconds.
Elapsed time is 0.171379 seconds.
Elapsed time is 0.177019 seconds.
Elapsed time is 0.184702 seconds.
Elapsed time is 0.190900 seconds.
Elapsed time is 0.196220 seconds.
Elapsed time is 0.203718 seconds.
Do you have an idea why this speed breakdown occurs? And how can I make it faster?
Thank you very much for your help!

 채택된 답변

Image Analyst
Image Analyst 2011년 11월 15일

0 개 추천

Because the axes is getting "full" - not quite sure how else to describe it. Put the command "cla" before the call to imellipse and you'll see the times stay short no matter how many times you call it.

추가 답변 (1개)

Erwin
Erwin 2011년 11월 15일

0 개 추천

Thank you very much, you helped me a lot! :)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2011년 11월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by