Find, fill, or remove missing data in the Live Editor
The Clean Missing Data task lets you interactively handle missing
data values such as NaN
or <missing>
. The task
automatically generates MATLAB® code for your live script.
Using this task, you can:
Find, fill, or remove missing data in a workspace variable.
Customize the method for filling data.
Automatically visualize the missing data and the cleaned data.
To add the Clean Missing Data task to a live script in the MATLAB Editor:
On the Live Editor tab, select Task > Clean Missing Data.
In a code block in the script, type a relevant keyword, such as
missing
or remove
. Select Clean
Missing Data from the suggested command completions.
Fill method
— Method for filling missing dataLinear interpolation
(default) | Constant value
| Previous value
| Next value
| Nearest value
| Spline interpolation
| Shape-preserving cubic interpolation (PCHIP)
| Modified Akima cubic interpolation
| Moving median
| Moving mean
| ...Specify the method for filling missing data using one of the following options.
Method | Description |
---|---|
Linear interpolation | Linear interpolation of neighboring, nonmissing values. |
Constant value | Specified constant value. |
Previous value | Previous nonmissing value. |
Next value | Next nonmissing value. |
Nearest value | Nearest nonmissing value. |
Spline interpolation | Piecewise cubic spline interpolation. |
Shape-preserving cubic interpolation | Shape-preserving piecewise cubic spline interpolation. |
Modified Akima cubic interpolation | Modified Akima cubic Hermite interpolation. |
Moving median | Moving median with specified window size. |
Moving mean | Moving mean with specified window size. |
Window
— Window for moving methodsCentered
(default) | Asymmetric
Specify the window type and size when the method for filling missing data is
Moving median
or Moving
mean
.
Window | Description |
---|---|
Centered | Specified window length centered about the current point |
Asymmetric | Specified window containing the number of elements before the current point and the number of elements after the current point |
Window sizes are relative to the X-axis variable units.