Check validity of input argument.
Confirms that the argument A is valid by belonging to one of classes, and holding all of the attributes. If it does not, an error is thrown, with a message formatted accordingly. The error message can be made further complete by the function name fun_name, the argument name arg_name, and its position in the input arg_idx.
classes must be a cell array of strings (an empty cell array is allowed) with the name of classes (remember that a class name is case sensitive). In addition to the class name, the following categories names are also valid:
"float"
Floating point value comprising classes "double"
and
"single"
.
"integer"
Integer value comprising classes (u)int8, (u)int16, (u)int32, (u)int64.
"numeric"
Numeric value comprising either a floating point or integer value.
attributes must be a cell array with names of checks for A. Some of them require an additional value to be supplied right after the name (see details for each below).
"<="
All values are less than or equal to the following value in attributes.
"<"
All values are less than the following value in attributes.
">="
All values are greater than or equal to the following value in attributes.
">"
All values are greater than the following value in attributes.
"2d"
A 2-dimensional matrix. Note that vectors and empty matrices have 2 dimensions, one of them being of length 1, or both length 0.
"3d"
Has no more than 3 dimensions. A 2-dimensional matrix is a 3-D matrix whose 3rd dimension is of length 1.
"binary"
All values are either 1 or 0.
"column"
Values are arranged in a single column.
"decreasing"
No value is NaN, and each is less than the preceding one.
"diag"
Value is a diagonal matrix.
"even"
All values are even numbers.
"finite"
All values are finite.
"increasing"
No value is NaN, and each is greater than the preceding one.
"integer"
All values are integer. This is different than using isinteger
which only checks its an integer type. This checks that each value in
A is an integer value, i.e., it has no decimal part.
"ncols"
Has exactly as many columns as the next value in attributes.
"ndims"
Has exactly as many dimensions as the next value in attributes.
"nondecreasing"
No value is NaN, and each is greater than or equal to the preceding one.
"nonempty"
It is not empty.
"nonincreasing"
No value is NaN, and each is less than or equal to the preceding one.
"nonnan"
No value is a NaN
.
"nonnegative"
All values are non negative.
"nonsparse"
It is not a sparse matrix.
"nonzero"
No value is zero.
"nrows"
Has exactly as many rows as the next value in attributes.
"numel"
Has exactly as many elements as the next value in attributes.
"odd"
All values are odd numbers.
"positive"
All values are positive.
"real"
It is a non-complex matrix.
"row"
Values are arranged in a single row.
"scalar"
It is a scalar.
"size"
Its size has length equal to the values of the next in attributes.
The next value must is an array with the length for each dimension. To
ignore the check for a certain dimension, the value of NaN
can be
used.
"square"
Is a square matrix.
"vector"
Values are arranged in a single vector (column or vector).
See also: isa, validatestring, inputParser.
Package: octave