Returns indices of non-zero elements or NA if none found.
FIND(series)
(row, col) = FIND(series)
(row, col, val) = FIND(series)
series |
- |
A series or array. |
A series or array.
(row, col) = FIND(series) returns the row and column indices of the
(row, col, val) = FIND(series) returns the row and column indices and the
a = {1, 0, 5};
b = find(a);
c = find(a > 1);
d = a[b];
returns the following:
b == {1, 3}
c == {3}
d == {1, 5}
a = {{1, 2, 3}, {4, 5, 2}, {2, 8, 9}}
b = find(a == 2);
c = a[b];
b and c return:
b == {3, 4, 8}
c == {2, 2, 2}
The following statement:
(r, c) = find(a == 2)
returns:
r == {3, 1, 2}
c == {1, 2, 3}
(r, c, v) = find((a>=5)*a)
r == {2, 3, 3}
c == {2, 2, 3}
v == {5, 8, 9}
As indicated by the second example, FIND returns the indices of the non-zero elements of array as a single "unraveled" series. These indices can be used to address arrays.