mustBeNonmissing
Checks that the input has no missing values.
Category: Programming > Functions
Syntax
mustBeNonmissing(A)
Checks that A contains no missing values. Returns nothing if the check passes and throws an error if not.
Description
mustBeNonmissing is a validator: it inspects its input and either returns silently or raises an error with the identifier MATLAB:validators:mustBeNonmissing. The error message states the requirement that was violated, so the caller sees what was expected rather than a generic failure.
Missing means NaN for numeric arrays and <missing> for strings. Ordinary text in a character array is never missing. Unlike mustBeFinite, an Inf value is accepted.
Input arguments
A- The value to check. Any array of the class the validator accepts.
Example
Passing and failing input
mustBeNonmissing([1 2 3]);
disp('passed')
try
mustBeNonmissing([1 NaN])
catch err
disp(err.message)
end
Output
passed
Value must not have missing data.