R/find.R

Defines functions find

Documented in find

###
### $Id: find.R 29 2022-05-30 23:02:22Z proebuck $
###
### Find indices of nonzero elements.
###


##-----------------------------------------------------------------------------
find <- function(x) {
    expr <- if (is.logical(x)) {
                x
            } else {
                x != 0
            }
    which(expr)
}

Try the matlab package in your browser

Any scripts or data that you put into this service are public.

matlab documentation built on June 2, 2022, 1:09 a.m.