Using the C Math Library | ![]() ![]() |
Deleting Array Elements
Use the function mlfIndexDelete()
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 matrix. The MATLAB C Math Library removes those elements and shrinks the array.
For example, to delete elements from example matrix A
, you simply pass the target array, the index string, and the value of the indices that identify the elements to be removed.
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. For example, when element (8
) is deleted from matrix A
mlfIndexDelete(&A, "(?)", mlfScalar(8));
matrix A
becomes this row vector with element 8
missing:
1 2 3 4 5 6 7 9
![]() | Extending Two-Dimensional Assignment to N Dimensions | Deleting Multiple Elements | ![]() |