Doug Hull, MathWorks
(Originally posted on Doug's MATLAB Video Tutorials blog.)
When you vectorize code, you avoid looping through an array and instead do operations on the matrix level. This avoids for loops in MATLAB. The reason for vectorizing are often stylistic. Vectorizing is preferred because it can make your code shorter, easier to read and maintain. This simple example contrasts for loop and vectorized implementations of the same algorithm.
Recorded: 4 Jun 2014