Arguments Validators
List of predefined validators that can be used in arguments block.
Name | Meaning | Example |
mustBeA(value, datatype) | value must be of datatype or subtype |
mustBeA(x, ["double", "string"])
mustBeA(x, ["figure", "polyline"])
mustBeA(x, ["frame", "pushbutton"]) |
mustBeEqualDims(value1, value2) | value1 and value2 must be of the dimensions |
mustBeEqualDims(x, y) |
mustBeFile(value) | value must be a valid file path |
mustBeFile(x) |
mustBeFinite(value) | value must be different of %nan and %inf |
mustBeFinite(x) |
mustBeFolder(value) | value must be a valid folder path |
mustBeFolder(x) |
mustBeGreaterThan(value, c) | value > c |
mustBeGreaterThan(x, 10) |
mustBeGreaterThanOrEqual(value, c) | value >= c |
mustBeGreaterThanOrEqual(x, 10) |
mustBeInRange(value, l, u [, bounds]) | value must be in range of [u, l], bounds can be
- "inclusive" (default) - "exclusive - "exclude-lower" - "exclude-upper" |
mustBeInRange(x, 0, 10)
mustBeInRange(x, 0, 10, "exclusive") |
mustBeInteger(value) | value must be an integer value |
mustBeInteger(x) |
mustBeLessThan(value, c) | value < c |
mustBeLessThan(x, 10) |
mustBeLessThanOrEqual(value, c) | value <= c |
mustBeLessThanOrEqual(x, 10) |
mustBeMember(value, members) | value must be a member of members |
mustBeMember(x, [1 3 5 7]) |
mustBeNegative(value) | value < 0 |
mustBeNegative(x) |
mustBeNonNan(value) | value must be different of %nan |
mustBeNonNan(x) |
mustBeNonempty(value) | value must be non empty | mustBeNonempty(x) |
mustBeNonnegative(value) | value >= 0 |
mustBeNonnegative(x) |
mustBeNonpositive(value) | value <= 0 |
mustBeNonpositive(x) |
mustBeNonsparse(value) | value is not sparse |
mustBeNonsparse(x) |
mustBeNonzero(value) | value <> 0 |
mustBeNonzero(x) |
mustBeNonzeroLengthText(value) | value must be a string with nonzero length |
mustBeNonzeroLengthText(x) |
mustBeNumeric(value) | value must be a number datatype (double, ints, ...) |
mustBeNumeric(x) |
mustBeNumericOrBoolean(value) | value must be a number datatype (double, ints, ...) or boolean |
mustBeNumericOrBoolean(x) |
mustBeNumericOrLogical(value) | value must be a number datatype (double, ints, ...) or boolean |
mustBeNumericOrLogical(x) |
mustBePositive(value) | value > 0 |
mustBePositive(x) |
mustBeReal(value) | value must be real |
mustBeReal(x) |
mustBeSameType(value1, value2) | value1 and value2 must be of same type |
mustBeSameType(x, y) |
mustBeScalarOrEmpty(value) | value must be scalar or empty |
mustBeScalarOrEmpty(x) |
mustBeValidVariableName(value) | value must be a valid variable name |
mustBeValidVariableName(x) |
mustBeVector(value) | value must be a vector |
mustBeVector(x) |
See also
- Arguments — keyword to check function arguments
History
バージョン | 記述 |
2024.0 | Introduction in Scilab. |
Report an issue | ||
<< arguments | Control flow | break >> |