Effacer les filtres
Effacer les filtres

Is there a faster way of updating elements in a big matrix?

2 vues (au cours des 30 derniers jours)
Chaoyang Jiang
Chaoyang Jiang le 5 Juil 2018
Commenté : dpb le 5 Juil 2018
Is there a faster way of updating elements in a big matrix?
Currently, I have A with a size of 9000000*8760. Each loop I need to update some elements, like: B=randi(800000,10000,1); A(B,:)=5;
Is there a faster way of dealing with big data?
Thank you.
  1 commentaire
dpb
dpb le 5 Juil 2018
Until run profiler to know where are slow spots specifically any micro optimization is premature.
W/o other information on code structure nothing to be said;
A(B,:)=5;
is about as efficient as it gets presuming elements of B are already in A which is a class double array...the hint may be in the earlier phrase of "Each loop...". Perhaps that loop or significant portions could be vectorized or otherwise are the bottleneck but crystal ball is in shop for repair (yet again)...

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by