Skip to content

mustBePositive

miscellaneous · scripts/miscellaneous/mustBePositive.m

: mustBePositive (x)

Error unless every element of x is greater than zero (x real numeric or logical; empty passes).

Intended as a validation function for inputParser and similar checks; it returns nothing and raises an error describing the offending elements when the check fails.