4.1) Scalars, Vectors And Matrices
- All numerical variables within Matlab are arrays.
- Scalars, vectors and matrices are represented as multi-dimensional arrays.
- A scalar is a 2-D array of size 1x1
- A vector is a 2-D array of 1xN (row vector) or Nx1 (column vector).
- Be careful – programming errors are caused by using a row vector where a column vector is required and vice versa. Matlab distinguishes between these.
- A matrix is a 2-D MxN array
- Higher dimensional arrays can also be constructed
- For example, an array of dimensions MxNxPxQ is a 4-D array (note that we don't use the letter o as a variable name as it could be confused with zero).
- Arrays are used to store data. Later we will learn how to load data from files.