Chapter 5

Vectorized Code

Contents

Key Terms

vectorizing

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.