CHAPTER 1Working with MATLAB® Data

1.1 Introduction

MATLAB® is an abbreviation of “matrix laboratory,” and while the ability to work with matrices is still an essential part of the program, the software also works with numerous other data types. This chapter examines several of the different data types you are likely to encounter and the functions needed to manipulate them.

This material and the subsequent chapters assume you know how to open MATLAB, enter commands in the Command Window, and create and identify variables and their types in the Workspace. If you lack those skills, consider working through the MATLAB Onramp training program, which is available free online in The MathWorks® MATLAB Academy (matlabacademy.mathworks.com) and takes just a few hours to complete.

Key concepts introduced in this chapter include:

  • MATLAB array types
  • Flexible data structures

Software required for this chapter: MATLAB base program.

1.2 Arrays

An array is a data series arranged in rows and columns. The usual notations to denote the number of rows and columns are r × c (rows by columns) or m × n (also signifying rows by columns). Table 1.1 shows the MATLAB terminology used to distinguish arrays.

Table 1.1 MATLAB Data Terminology

Term Size Example
Scalar 1 × 1 (1 row by 1 column) 7
Row vector 1 × n (1 row by n columns) [1 2 3]
Column vector m × 1 (m rows by 1 column) images
Matrix ...

Get Foundations of Computational Finance with MATLAB now with the O’Reilly learning platform.

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