missing

Creates a missing value placeholder that works for any data type.

Category: Data Import and Analysis > Preprocessing Data

Syntax

m = missing

Returns a scalar missing value.

Description

missing is a type-independent way to say that a value is absent. When it is placed in an array, it is converted to the standard missing marker of that array: NaN for numbers, <missing> for strings, NaT for datetimes. ismissing detects all of these uniformly.

It is handy when building a string array with gaps, or when filling a table whose columns have different types.

Output arguments

m
The missing value. It prints as <missing>.

Example

A gap in a string array

s = ["a" missing "c"]
ismissing(s)
ismissing([1 NaN 3])
Output
s = 1×3 string array

    "a"    <missing>    "c"
ans = 1×3 logical array

   0   1   0
ans = 1×3 logical array

   0   1   0

Notes

In MatLivre class(missing) reports 'string', whereas in MATLAB it is 'missing'. Assigning missing into a numeric array is not supported; use NaN.

See also

ismissing fillmissing rmmissing standardizeMissing