Clean Missing Data
Find, fill, or remove missing data in the Live Editor
Description
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.
Define nonstandard missing value indicators.
Visualize the missing data and the cleaned data.
Open the Task
To add the Clean Missing Data task to a live script in the MATLAB Live Editor:
On the Live Editor tab, click Task and select the Clean Missing Data icon
.
In a code block in the live script, type a relevant keyword, such as
missing
orremove
. SelectClean Missing Data
from the suggested command completions.
Examples
Parameters
Input data
— Valid input data from workspace
vector | table | timetable
This task operates on input data contained in a vector, table, or timetable. The
data can be of type single
, double
,
duration
, calendarDuration
,
datetime
, categorical
,
string
, char
, or cell
arrays of
character vectors.
When providing a table or timetable for the input data, select All
supported variables
to clean all variables with a supported type. Select
All numeric variables
to clean all variables of type
single
or double
. To choose specific supported
variables to clean, select Specified variables
and then
select the variables individually.
Fill method
— Method for filling missing data
Linear interpolation
(default) | Constant value
| Previous value
| ...
Specify the method for filling missing data as one of these options.
Method | Description |
---|---|
Linear interpolation | Linear interpolation of neighboring, nonmissing values |
Constant value | Specified scalar value, which is 0 by default |
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
(PCHIP) | 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 |
Custom function | Custom fill method, specified as a local function or a function handle |
Window
— Window for moving methods
Centered
(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.
Version History
Introduced in R2019bSee Also
Functions
Live Editor Tasks
- Clean Outlier Data | Find Local Extrema | Smooth Data | Remove Trends | Find Change Points | Normalize Data | Compute by Group