findΒΆ

The find function finds the indices of all matrix elements which do not equal 0.

rvIndexes = find(rvM)

Return Value

rvIndexes contains the indices of the elements of rvM which are not equal to 0.

Parameters

rvM

rvM is a real matrix. If all matrix elements are equal to 0 (zero) the function will return 0.

Comment

find is mainly used in conjunction with comparison operators. If rvM is a matrix, the function returns the indices of the internal representation of the matrix.

Example

a = [1, 2, 6, 45, 3, 11]
b = find(a >= 6)
print a[b]             // Output: 6 45 11
a = ["abc", "def", "jkl"]
b = find(a != "def")
print b                // Output: 1 3
print a[b]            // Output: abc jkl

id-860771