Using the C Math Library | ![]() ![]() |
Specifying the Values for Indices
Because the second argument, the index string, only describes the types of operations to be performed and does not contain the actual subscript values, you must pass these values separately to the indexing functions. Following the indexing string argument, you pass a list of pointers to mxArray
s.
Each array contains the value of an index in your subscript(s).
For example, the two calls to mlfScalar()
in the following indexing expression pass the values for the indices in the two-dimensional subscript (2,1)
. If A
were an array with more than two dimensions, you could specify more than two dimensions in the index string, and pass more than two index values to mlfIndexRef()
.
mlfIndexRef(A, "(?,?)", mlfScalar(2), mlfScalar(1))
The indexing functions apply the subscript to the target array. Each function constructs the subscript based on the content of the indexing string. The indexing functions count the number of expressions that are delimited by commas within each parenthesized, ()
, or bracketed, {}
, subscript within the indexing string to determine the structure of the subscript(s) and the number of mxArray*
index arguments to expect.
![]() | Specifying the Index String | Specifying a Source Array for Assignments | ![]() |