C Math Library Reference | ![]() ![]() |
Deletes from the target array the element (or elements) specified by the subscript
C Prototype
mxArray *mlfIndexDelete(mxArray *volatile *pa, const char* index_string, ...);
Arguments
mxArray **pa
Specifies the address of the array you want to delete elements from.
"(?,?)"
. mlfIndexRef()
does not use index values specified in the subscript string.
mxArray* 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 mlfIndexDelete()
to delete elements from an array. This function is equivalent to the MATLAB statement, A(B) = []
. The MATLAB C Math Library removes the 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 array. You can also delete more than one element from an array, shrinking the array by that number of elements. To retain the rectangularity of a matrix, however, you must delete one or more entire rows or columns.
Example
This code 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.
/* In MATLAB: A(3,1) = [] */
mxArray *A = NULL;mlfIndexDelete(&A, "(3,1)", mlfScalar(3), mlfScalar(1));
See Also
![]() | mlfIndexAssign | mlfIndexRef | ![]() |