Speeding up large array element access/modification in class
Mostrar comentarios más antiguos
Hi all,
So I have a class and one of its properties is an array which is initialised to:
large_array = zeros(1,1000000);
I also have a method in the class:
function log(this)
this.large_array(1,this.current_iteration) = this.some_value;
end
My problem is this method which updates a value in the array per iteration takes AGES (89.9% of the total program time). I am already preallocating the array so I do not understand why it is taking so long. So my questions are:
Why is this taking so long?
How can I speed the accessing/modifying up?
Thanks for your time, Richy
Respuestas (1)
Richard
el 24 de Mzo. de 2011
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!