Programming and Data Types | ![]() ![]() |
Multidimensional Arrays
Multidimensional arrays in MATLAB are an extension of the normal two-dimensional matrix. Matrices have two dimensions: the row dimension and the column dimension.
You can access a two-dimensional matrix element with two subscripts: the first representing the row index, and the second representing the column index.
Multidimensional arrays use additional subscripts for indexing. A three-dimensional array, for example, uses three subscripts:
To access the element in the second row, third column of page 2, for example, you use the subscripts (2,3,2)
.
As you add dimensions to an array, you also add subscripts. A four-dimensional array, for example, has four subscripts. The first two reference a row-column pair; the second two access the third and fourth dimensions of data.
![]() | Function Summary | Creating Multidimensional Arrays | ![]() |