slow re-assignment of values to an array in a structure
Afficher commentaires plus anciens
Here is my problem: Why does line 6 below take two orders of magnitude more time to compute than other instances of the same command?
1.>> x = ones(100,100,250);
2.>> tic; x(:,:,23) = rand(100,100) ; toc
Elapsed time is 0.000433 seconds.
3.>> tic; x(:,:,23) = rand(100,100) ; toc
Elapsed time is 0.000420 seconds.
4.>> tic; x(:,:,23) = rand(100,100) ; toc
Elapsed time is 0.000417 seconds.
5.>> s.x = x;
6.>> tic; x(:,:,23) = rand(100,100) ; toc
Elapsed time is 0.013906 seconds.
7.>> tic; x(:,:,23) = rand(100,100) ; toc
Elapsed time is 0.000435 seconds.
8.>> tic; x(:,:,23) = rand(100,100) ; toc
Elapsed time is 0.000537 seconds.
*******
In my application I send a large structure of arrays into a subroutine and I observe it running super slowly and I think this is the issue.
Any explanation?
Réponse acceptée
Plus de réponses (1)
Jonathan
le 10 Avr 2011
0 votes
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!