Skip to main content
Logo image

Chapter 3 Arrays

In the previous chapters, you learned how to work with individual numbers and basic calculations in MATLAB. While scalar values are useful, much of MATLABโ€™s power comes from its ability to work efficiently with collections of numbers called arrays. In fact, the name MATLAB stands for โ€œMatrix Laboratoryโ€, emphasizing the languageโ€™s focus on array-based computing.
Arrays allow you to store multiple related values in a single variable and perform operations on all elements simultaneously. This approach, known as vectorization, is not only more efficient computationally but also leads to cleaner, more readable code. Understanding how to create, access, and manipulate arrays is fundamental to effective MATLAB programming.
This chapter introduces arrays systematically. You will learn how to create arrays using different methods, how to access individual elements or groups of elements through indexing, and how to perform mathematical operations on arrays. By the end of this chapter, you will be comfortable working with one-dimensional vectors and two-dimensional matrices, and you will understand how MATLABโ€™s array operations enable you to write concise, powerful programs.