ismissing
Marks missing values: NaN, NaT, missing strings, undefined categories and empty text.
Category: Language Fundamentals > Data Types
Syntax
tf = ismissing(A)
Returns a logical array that is true where an element is missing.
Description
What counts as missing depends on the type. For floating-point numbers it is NaN; for datetime NaT; for a string array the missing value; for a categorical array an undefined element; and for a cell array of character vectors an empty vector ''.
Integer and logical arrays cannot hold a missing value, so the result is all false. A related function, rmmissing, removes the flagged elements.
Input arguments
A- Numeric array, string array, cell array of character vectors, categorical, datetime or duration array.
Output arguments
tf- Logical array the same size as
A.
Example
Different kinds of missing
ismissing([1 NaN 3])
ismissing(["a", missing])
ismissing({'a', ''})
ismissing(categorical({'a', ''}))
ans = 1×3 logical array
0 1 0
ans = 1×2 logical array
0 1
ans = 1×2 logical array
0 1
ans = 1×2 logical array
0 1
Notes
For tables and for character matrices, MatLivre's ismissing does not flag every entry that MATLAB flags (for example blank characters). Prefer applying it to plain arrays.