Chapter 5

Vectorized Code


Key Terms


scalar operations

array operations

logical vectors

logical indexing

Although loops are extremely useful in most programming applications and necessary in many languages, in the MATLAB® software they are frequently not necessary especially when dealing with vectors or matrices. In this chapter, the concept of vectorizing will be introduced, which is the term used in MATLAB for rewriting code that was written using constructs such as loops in a traditional programming language and instead taking advantage of array ...

Get Matlab: A Practical Introduction to Programming and Problem Solving, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.