Using the C Math Library | ![]() ![]() |
Overview
A one-dimensional subscript contains a single index. When you use the MATLAB C Math Library to perform one-dimensional indexing, you pass mlfIndexRef()
a pointer to one array that represents the index. The index array can contain a scalar, vector, matrix, or the return from a call to the mlfCreateColonIndex()
function.
The size and shape of the one-dimensional index determine the size and shape of the result; the size of the result is exactly equal to the size of the one-dimensional subscript. For example, a one-dimensional row vector index produces a one-dimensional row vector result. Given the matrix A
, the expression A([1 5 8])
produces the row-vector [ 1 5 8 ]
. To view the definition of matrix A
, see Assumptions for the Code Examples.
To apply a one-dimensional subscript to an N-dimensional array, you need to know how to go from the one-dimensional index value to a location inside the array. See Array Storage for complete details on how MATLAB counts one dimensionally through arrays of N dimensions.
![]() | One-Dimensional Indexing | Selecting a Single Element | ![]() |