The function removes or replaces values that fall in a certain range.
The argument input `reference` could be a channel name (e.g. sea pressure), `time`, or `index`. The following input `range` is a 2 element vector of minimum and maximum values. The samples in `reference` that fall within the range (including the edge) will be trimmed. When `reference` is `time`, the range must be in MATLAB datenum format. When `reference` is `index`, obviously the range must be integer numbers.
The function provides three methods to deal with flagged data, which are:
- `NaN` - replace flagged samples with NaN
- `remove` - remove flagged samples
- `interp` - replace flagged samples with interpolated values by neighbouring points.