Next: findfile, Previous: filewrite, Up: Internal Routines [Contents][Index]

`find(`

`array`, `key` [, `offset`] [, /exact, /index_ge,
/value_ge, /first])

Finds the first occurrence of each element of

, starting
at (the corresponding element of) `key`

in
`offset`

. The search mode keywords are:
`array`

`/exact`

Seek exact match, return offset or

`-1`

if none found.`/index_ge`

Seek first element greater than or equal to the key. Return offset or

`-1`

, if none found.`/value_ge`

Seek first element greater than or equal to the key. Return found element, or

`-1`

if none found.`/first`

Return a result for each combination of the second and higher dimensions.

e.g., if `x`

is a 3 by 5 by 4 array, then `find(x,[1,2])`

returns the indices of the first occurrence of 1 and 2 in `x`

,
irrespective of the dimensional structure of `x`

, and
`find(x,[1, 2],/first)`

returns a 2 by 5 by 4 array with the
results of `find(x(*,0,0),1), find(x(*,1,0),1),`

etcetera.

may be a scalar or an array. `key`

may
be a scalar or an array of the same size as `offset`

.
`key`

See also: find_maxloc