FUNCTION REFERENCE

find

Indices of nonzero elements.

Indices of nonzero elements.

Syntax

find(A)

Returns linear indices. A row vector gives a row; any other shape gives a column.

Example

find([0 3 0 5])   % [2 4]

Example

find(reshape([0 1 0 1],1,2,2))   % [2; 4]

Differences from MATLAB: 2-D input takes no n or direction arguments and has no row/column index outputs. N-D arrays (part 2): find(A,n), find(A,n,'first'|'last'), [r,c] = find(A) (c folds the trailing dimensions) and [r,c,v] = find(A).

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.