C Math Library Reference | ![]() ![]() |
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
Specifies the address of the target array that will be modified.
"(?,?)"
. mlfIndexRef()
does not use index values specified in the subscript string.
Additional arguments
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 the modified array.
Description
Use the function mlfIndexAssign()
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 value 45
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
![]() | mlfFevalTableSetup | mlfIndexDelete | ![]() |