C Math Library Reference | ![]() ![]() |
Delete elements from a one or two-dimensional array.
This routine is superseded by the mlfIndexDelete
() routine, which supports multidimensional, cell array, and structure indexing.
C Prototype
void mlfArrayDelete(mxArray *destination, mxArray *index1, ... );
Arguments
mxArray *destination
Specifies the array that you want to delete elements from.
mxArray *index1
Terminate the argument list by passing NULL
as the last argument.
Return
This function returns void
. The result of the deletion is stored in the argument destination
.
Description
Use the function mlfArrayDelete()
to delete elements from an array. This function is equivalent to the MATLAB statement, A(B) = []
. Instead of specifying a subscript for the elements you want to replace with other values, specify a subscript for the elements you want removed from the array. The MATLAB C Math Library removes those elements and shrinks the array.
When you delete a single element from a matrix, the matrix is converted into a row vector that contains one fewer element than the original matrix. You can also delete more than one element from a matrix, shrinking the matrix by that number of elements. To retain the rectangularity of the matrix, however, you must delete one or more entire rows or columns.
Example
mlfArrayDelete(A, three, one, NULL);
This function removes the element at row three, column one from array A
. Note that removing an element from a matrix reshapes the matrix into a vector.
See Also
mlfArrayAssign
, mlfArrayRef
, mlfColon
, mlfCreateColonIndex
, mlfEnd
![]() | mlfArrayAssign | mlfArrayRef | ![]() |