Why gets imellipse slower and slower in a loop?
Show older comments
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!
Accepted Answer
More Answers (1)
Erwin
on 15 Nov 2011
0 votes
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!