Back to Core Functions
find
Find indices of nonzero elements
Syntax
k = find(X) k = find(X, n) k = find(X, n, direction)
Description
Returns the linear indices of nonzero elements in X. Optionally returns only the first or last n indices.
Parameters
| Name | Description |
|---|---|
| X | Input array |
| n(optional) | Number of indices to return |
| direction(optional) | 'first' (default) or 'last' - which indices to return |
Returns
Vector of indices (1-based)