Categories &

Functions List

Function Reference: rmmissing

statistics: R = rmmissing (A)
statistics: R = rmmissing (A, dim)
statistics: R = rmmissing (…, Name, Value)
statistics: [R, TF] = rmmissing (…)

Remove missing data from arrays.

Given an input vector or matrix (2-D array) A, R = rmmissing (A) returns an output vector or matrix R of the same type as input A and any missing elements removed. If A is a vector, missing elements are removed individually, if A is a matrix, then rows containing missing elements are removed.

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 data types that do not support missing values, rmmissing returns R == A and if a second output argument is requested it also returns TF = false (size (A)).

Given an input matrix (2-D array) A, R = rmmissing (A, dim) further specifies whether rows or columns containing missing data are removed from the output R based on the value of dim, which must be either 1 or 0.

  • 1: remove rows.
  • 2: remove columns.

R = rmmissing (…, Name, Value) also accepts the following paired arguments.

NameValue
'MinNumMissing'A positive integer scalar value specifying the required minimum number of missing values for removing any particular row or column from a matrix input. Note that this argument is ignored if input A is a vector.
'MissingLocations'A logical array of the same size as input A indexing the locations of missing values in input array A. Note that specifying 'MissingLocations' overrides any standard missing values in A.

Optional return value TF is a logical array where true values represent removed entries, rows or columns from the original data A.

See also: fillmissing, ismissing, standardizeMissing

Source Code: rmmissing