C Math Library Reference    
mlfIndexRef

Extract elements specified by the subscript from the target array and return the result in a new mxArray

C Prototype

Arguments
mxArray *pa
   Specifies the array that you want to extract elements from.

const char* index_string
   A string that specifies the dimensionality of the subscript and the style of indexing (array indexing or cell array indexing) that is applied to the target array. Use a ? in the place of each index value, for example, "(?,?)". mlfIndexRef() does not use index values specified in the subscript string.

mxArray* arguments
   [Optional] Arrays that specify the values of the indices. Provide one index for one-dimensional indexing, two for two-dimensional indexing, n indices for n-dimensional indexing.

You do not need to terminate the list of arguments with NULL; the indexing functions can detect the number of expected arguments.

Return

Returns a pointer to a new mxArray that contains the extracted data.

Description

mlfIndexRef(), along with mlfIndexAssign() and mlfIndexDelete(), provides access to array elements in the MATLAB C Math Library. These routines emulate the MATLAB indexing operator ().

mlfIndexRef() copies the value of an array element into another array; it does not modify the element in the target array. To assign a value to an array element, use mlfIndexAssign(). To delete the value of an array element, use mlfIndexDelete().

Example

This code selects the element at row 2, column 2 in array A and returns it in B.

See Also

mlfIndexAssign, mlfIndexDelete


 mlfIndexDelete mlfIndexVarargout