Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Detect and replace outliers in data

`B = filloutliers(A,fillmethod)`

`B = filloutliers(A,fillmethod,findmethod)`

`B = filloutliers(A,fillmethod,movmethod,window)`

`B = filloutliers(___,dim)`

`B = filloutliers(___,Name,Value)`

```
[B,TF,L,U,C]
= filloutliers(___)
```

finds
outliers in `B`

= filloutliers(`A`

,`fillmethod`

)`A`

and replaces them according to `fillmethod`

.
For example, `filloutliers(A,'previous')`

replaces
outliers with the previous non-outlier element. By default, an outlier
is a value that is more than three scaled median absolute deviations (MAD) away
from the median. If `A`

is a matrix or table, then `filloutliers`

operates
on each column separately. If `A`

is a multidimensional
array, then `filloutliers`

operates along the first
dimension whose size does not equal 1.

specifies
a method for determining outliers. For example, `B`

= filloutliers(`A`

,`fillmethod`

,`findmethod`

)`filloutliers(A,'previous','mean')`

defines
an outlier as an element of `A`

more than three standard
deviations from the mean.

specifies
a moving method for determining local outliers according to a window
length defined by `B`

= filloutliers(`A`

,`fillmethod`

,`movmethod`

,`window`

)`window`

. For example, `filloutliers(A,'previous','movmean',5)`

identifies
outliers as elements more than three local standard deviations away
from the local mean within a five-element window.

specifies
additional parameters for detecting and replacing outliers using one
or more name-value pair arguments. For example, `B`

= filloutliers(___,`Name,Value`

)`filloutliers(A,'previous','SamplePoints',t)`

detects
outliers in `A`

relative to the corresponding elements
of a time vector `t`

.

`[`

also returns information about the position of the outliers and thresholds computed
by the detection method. `B`

,`TF`

,`L`

,`U`

,`C`

]
= filloutliers(___)`TF`

is a logical array indicating the
location of the outliers in `A`

. The `L`

,
`U`

, and `C`

arguments represent the lower and
upper thresholds and the center value used by the outlier detection method.

Was this topic helpful?