k = find(X)[i,j] = find(X)[i,j,s] = find(X)
k = find(X) returns the indices of the vector X that point to nonzero elements. If none is found, find returns an empty matrix. If X is a matrix, find regards X as X(:), which is the long column vector formed by concatenating the columns of X.
[i,j] = find(X) returns the row and column indices of the nonzero entries in the matrix X. This is often used with sparse matrices.
[i,j,s] = find(X) also returns a column vector of the nonzero entries in X. Note that find(X) and find(X ~= 0) produce the same i and j, but the latter produces an s with all 1s.
And on a matrixx = [11 0 33 0 55]';find(x) =135find(x == 0) =24find(0 < x & x < 10*pi) =1
M = magic(3)M =8 1 63 5 74 9 2[i,j,m] = find(M > 6)i =132j =123m =111
<,<=,>,>=,==,~=,isempty,nonzeros,sparse
(c) Copyright 1994 by The MathWorks, Inc.