validateattributes
Check validity of array
Syntax
Description
Note
Input argument validation using arguments blocks is
recommended over validateattributes. For additional
information, see Function Argument Validation.
validateattributes(
validates that array A,classes,attributes)A belongs to at least one of the specified
classes (or its subclass) and has all the specified attributes. If
A does not meet the criteria, then MATLAB® throws an error and displays a formatted error message. Otherwise,
validateattributes completes without displaying any
output.
validateattributes( includes the position of the input in your function argument list as part of any generated error messages.A,classes,attributes,argIndex)
validateattributes( includes the specified function name in generated error identifiers.A,classes,attributes,funcName)
validateattributes(
includes the specified variable name in generated error messages.A,classes,attributes,funcName,varName)
Examples
Input Arguments
Tips
When checking if an input belongs to a class specified in
classes,validateattributeschecks the underlying MATLAB datatype as determined byunderlyingType. In some cases, class and underlying type may differ.
Extended Capabilities
Version History
Introduced in R2007b