Main Content

Fill missing values

fills missing entries of an array or table with the constant value `F`

= fillmissing(`A`

,'constant',`v`

)`v`

. If
`A`

is a matrix or multidimensional array, then `v`

can
be either a scalar or a vector. When `v`

is a vector, each element
specifies the fill value in the corresponding column of `A`

. If
`A`

is a table or timetable, then `v`

can also be a cell
array whose elements contain fill values for each table variable.

Missing values are defined according to the data type of `A`

:

`NaN`

—`double`

,`single`

,`duration`

, and`calendarDuration`

`NaT`

—`datetime`

`<missing>`

—`string`

`<undefined>`

—`categorical`

`' '`

—`char`

`{''}`

—`cell`

of character arrays

If `A`

is a table, then the data type of each
column defines the missing value for that column.

fills gaps of missing entries using a custom method specified by a function handle
`F`

= fillmissing(`A`

,`fillfun`

,`gapwindow`

)`fillfun`

and a fixed window surrounding each gap from which the fill
values are computed. `fillfun`

must have the input arguments
`xs`

, `ts`

, and `tq`

, which are vectors
containing the sample data `xs`

of length `gapwindow`

, the
sample data locations `ts`

of length `gapwindow`

, and the
missing data locations `tq`

. The locations in `ts`

and
`tq`

are a subset of the sample points vector.

specifies
additional parameters for filling missing values using one or more
name-value pair arguments. For example, if `F`

= fillmissing(___,`Name,Value`

)`t`

is
a vector of time values, then `fillmissing(A,'linear','SamplePoints',t)`

interpolates
the data in `A`

relative to the times in `t`

.

Clean Missing
Data | `filloutliers`

| `ismissing`

| `isnan`

| `missing`

| `rmmissing`

| `standardizeMissing`