REMOVE Function
discards elements from a matrix
- REMOVE( matrix, indices)
The inputs to the REMOVE function are as follows:
- matrix
- is a numeric or character matrix or literal.
- indices
- refers to a matrix containing the indices of
elements that are removed from matrix.
The REMOVE function returns as a row vector elements of the
first argument, with elements corresponding to the indices
in the second argument discarded and the gaps removed.
The first argument is indexed in row-major order, as
in subscripting, and the indices must be in the range
1 to the number of elements in the first argument.
Non-integer indices are truncated to their integer part.
You can repeat the indices, and you can give them in any order.
If all elements are removed, the result is
a null matrix (zero rows and zero columns).
Thus, the statement
a=remove({ 5 6, 7 8} , 3);
removes the third element, producing the
result shown:
A
5 6 8
The statement
a=remove({ 5 6 7 8} , { 3 2 3 1} );
causes all but the fourth element to
be removed, giving the result shown:
A
8
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.