MATLAB Answers

C Zeng

compare loops and matrix computation.

Asked by C Zeng
on 30 May 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...




No products are associated with this question.

1 Answer

Answer by Jonathan Sullivan on 30 May 2013
 Accepted answer

This has some good information on the topic:

  1 Comment

C Zeng
on 30 May 2013

Thanks, Jonathan!

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!