| MATLAB Central > MATLAB Newsreader > forloop efficiency |
|
|
|
I've been told to avoid forloops in matlab because they're extremely slow. |
|
I'm guessing it has something to do with the second command being able to do everything at once, while the frist one computes sequentially. But I only have 2 CPUs so I'm not sure how it's parallelizing it. |
|
Juliette Salexa wrote: |
|
"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message |
|
There is no trivial rule about "for-loop" is slow. It is quite hard to judge before hand whereas for-loop or vectorized solution is better. It needs quite a bit of experiences in Matlab in judge well, and even experience users are sometime stumbled. |
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
Contact us at files@mathworks.com
