compare loops and matrix computation.

15 vues (au cours des 30 derniers jours)
C Zeng
C Zeng le 30 Mai 2013
Hi, all,
I recently found that Matlab executes matrix/vector computation pretty fast than scalar computation with loops. For example, if I used loops to execute algorithm, it is very slow. If I convert it to vector or matrix, it is faster.
I was told about this fact before, is there any explanation on it?
The bad thing is that you cannot always use matrix to replace loops...
Thanks.

Réponse acceptée

Jonathan Sullivan
Jonathan Sullivan le 30 Mai 2013
  1 commentaire
C Zeng
C Zeng le 30 Mai 2013
Thanks, Jonathan!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements 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