function where
Create a one-dimensional array of indices which satisfy a given expression.
Syntax
result = where(array comparison scalar)
Arguments
array: | An array of any dimension that is to be evaluated |
comparison: | Any of the known comparison operators (==, !=, >, >=, <, <=) |
scalar: | A scalar value |
Returns
A one-dimensional vector of the indices in array which satisfied the comparison
Examples
Create a sine curve and set all negative values to 0:
sine = sin([0:1000]/100)
sine[where(sine < 0)] = 0