| MATLAB C Math Library | Search  Help Desk |
| mlfIndexAssign | Examples See Also |
Assign a value to an element (or elements) in the target array
C Prototype
mxArray *mlfIndexAssign(mxArray *volatile *pa,
const char* index_string, ...);
Arguments
mxArray **pa"(?,?)". mlfIndexRef() does not use index values specified in the subscript string.
Additional arguments
NULL; the indexing functions can detect the number of expected arguments.
Return
Returns a pointer to the modified array.Description
Use the functionmlfIndexAssign() to make array assignments that involve indexing. The arguments to mlfIndexAssign() consist of the destination array, an index string that specifies the elements that are to be modified in the destination array, one or more index arrays that specify the value for the subscript, and the source array.
The subscript specifies the elements that are to be modified in the destination array; the source array specifies the new values for those elements. The subscript is only applied to the destination array.
Example
This code writes the value45 into the element at row three, column one of array A. If you assign a value to a location that does not exist in the array, the array grows to include that element.
/* In MATLAB: A(3,1) = 45 */mxArray *A = NULL;mlfIndexAssign(&A, /* Destination array */"(?,?)", /* Index format string */mlfScalar(3), /* Subscript value */mlfScalar(1), /* Subscript value */
mlfScalar(45)); /* Source array */
See Also
mlfIndexRef, mlfIndexDelete