Multidimensional array

multidimensional array in MATLAB® is an array with more than two dimensions. In a matrix, the two dimensions are represented by rows and columns.



Each element is defined by two subscripts, the row index and the column index. Multidimensional arrays are an extension of 2-D matrices and use additional subscripts for indexing. A 3-D array, for example, uses three subscripts. The first two are just like a matrix, but the third dimension represents pages or sheets of elements.

Creating Multidimensional Arrays
You can create a multidimensional array by creating a 2-D matrix first, and then extending it. For example, first define a 3-by-3 matrix as the first page in a 3-D array.

A = [1 2 3; 4 5 6; 7 8 9]
A = 3×3

     1 2 3
     4 5 6
     7 8 9

Now add a second page. To do this, assign another 3-by-3 matrix to the index value 2 in the third dimension. The syntax A(:,:,2) uses a colon in the first and second dimensions to include all rows and all columns from the right-hand side of the assignment.
Posted on by