C Math Library Reference | ![]() ![]() |
Handles assignments that include one and two-dimensional indexing.
This routine is superseded by the mlfIndexAssign
() routine, which supports multidimensional, cell array, and structure indexing.
C Prototype
void mlfArrayAssign(mxArray *destination, mxArray *source, ... );
Arguments
mxArray *destination
Specifies the destination array that will be modified.
mxArray *source
Terminate the argument list by passing NULL
as the last argument.
Return
This function returns void
. The result of the assignment is stored in the argument destination
.
Description
Use the function mlfArrayAssign()
to make assignments that involve indexing. The arguments to mlfArrayAssign()
consist of a destination array, a source array, and one or two index arrays that represent the subscript. 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.
The functions are defined to accept a variable number of indices. Supply one index mxArray
argument to perform one-dimensional indexing. Supply two index mxArray
arguments to perform two-dimensional indexing.
Example
mxArray *fortyfive = mlfScalar(45);
mxArray *three = mlfScalar(3);
mxArray *one = mlfScalar(1);
mlfArrayAssign(A, fortyfive, three, one, NULL);
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.
See Also
mlfArrayDelete
, mlfArrayRef
, mlfColon
, mlfCreateColonIndex
, mlfEnd
![]() | Utility Routine Reference | mlfArrayDelete | ![]() |