findfirstΒΆ

findfirst finds the index of the first element that is not 0.

nIndex = findfirst(rvMatrix)

Return Value

nIndex is the index.

Parameters

rvMatrix

rvMatrix is a real vector.

Comment

findfirst works like find but returns only the first element.

Example

* a = ones(1,20)
* a[5,6,8] = 0
* findfirst(a == 0)
      5.0000

See also

find

id-1150011