Categories &

Functions List

Function Reference: standardizeMissing

statistics: B = standardizeMissing (A, indicator)

Replace selected values by standard missing values.

Β = standardizeMissing (A, indicator) returns a standardized array B of the same size and data type as the input array A and with all elements specified by indicator replaced by the standard missing value corresponding the data type of A. indicator can be either a scalar or a vector.

Standard missing values and their corresponding data types are:

  • NaN - for double, single, duration, and calendarDuration arrays.
  • NaT - for datetime arrays.
  • <missing> - for string arrays.
  • <undefined> - for categorical arrays.
  • {0x0 char} - for cell arrays of character vectors.

For any other data type input that does not support missing values, standardizeMissing returns B = A and any indicator value is ignored.

The nonstandard missing value indicator must be of the same type as the data input A or have a compatible data types according to the following rules:

  • all numeric indicators match both double and single data types in A.
  • indicators specified as string arrays, char vectors, and cell arrays of character vectors match categorical data type in A.
  • a char vector matches a cell array of character vectors in A.

Note: the generic standardizeMissing function from the statistics does not operate on table inputs, which is handled by the overloaded method of the table class. Use help table.standardizeMissing to find more information about the functional specialization on tables.

See also: fillmissing, ismissing, rmmissing

Source Code: standardizeMissing