function clip

Clips values in X. If VALUE is not set, all values below low will be set to low, and all values above high will be set to high. If value is set, all values above low AND below high are set to value.

Syntax
result = clip(X, LOW, HIGH [, VALUE])

Arguments
X:   The matrix to be clipped
LOW:   All values below this value will be set to LOW
HIGH:   All values above this value will be set to HIGH. If HIGH < LOW, no upper clipping will be done
VALUE:   Optional, if given then all values above LOW and below HIGH will be set to this value (inclusive clipping)