Using the C++ Math Library | ![]() ![]() |
Overview
An N-dimensional subscript contains N indices. The first index is the row index, the second is the column index, the third the page index, and so on. Each index can store a scalar, vector, matrix, or the result from a call to the function colon()
.
The size of the indices rather than the size of the subscripted matrix determines the size of the result; the size of the result is equal to the product of the sizes of the N indices. For example, assume matrix A
is set to:
1 4 7 2 5 8 3 6 9
If you index matrix A
with a 1-by-5 vector and a scalar, the result is a five-element vector: five elements in the first index times one element in the second index. If you index matrix A
with a three-element row index and a two-element column index, the result has six elements arranged in three rows and two columns.
![]() | Using N-Dimensional Subscripts | Selecting a Single Element | ![]() |