The REMOVE function discards elements from a matrix. The arguments to the REMOVE function are as follows:
is a numeric or character matrix or literal.
specifies the indices of elements of matrix to remove.
The REMOVE function returns (as a row vector) a subset of the elements of the first argument. Elements that correspond to indices in the second argument are removed. The elements of the first argument are enumerated in row-major order, and the indices must be in the range 1 to , where matrix is an matrix. Nonintegral indices are truncated to their integer part. You can repeat the indices and give them in any order. If all elements are removed, the result is an empty matrix with zero rows and zero columns.
The following statements remove the third element, creating a row vector with three elements:
x = {5 6, 7 8}; a = remove(x, 3); /* remove element 3 */ print a;
The following statements remove all but the fourth element:
r = {3 2 3 1}; b = remove(x, r); /* equivalent to removing elements 1:3 */ print b;
The output shown in Figure 24.321 shows that repeated indices are ignored.