missing - Create missing values - MATLAB (original) (raw)
Main Content
Syntax
Description
m = missing
returns a missing value displayed as <missing>
. You can set an element of an array or table to missing
to represent missing data. The value of missing
is then automatically converted to the standard missing value native to the data type of the array or table variable. For example, core data types that support missing
and their corresponding standard missing values after assignment are as follows:
double
,single
,duration
, andcalendarDuration
convertmissing
toNaN
datetime
convertsmissing
toNaT
categorical
convertsmissing
to<undefined>
string
convertsmissing
to<missing>
Examples
Missing Data in Timetable
Create a timetable containing weather data, and replace the last row with missing values. Each missing
value is automatically replaced with the standard missing value for the relevant data type.
Time = datetime({'2015-12-18 08:03:05';'2015-12-18 10:03:17';'2015-12-18 12:03:13'}); Temp = [37.3;39.1;42.3]; WindDirection = categorical({'NW';'N';'NW'}); TT = timetable(Time,Temp,WindDirection)
TT=3×2 timetable Time Temp WindDirection ____________________ ____ _____________
18-Dec-2015 08:03:05 37.3 NW
18-Dec-2015 10:03:17 39.1 N
18-Dec-2015 12:03:13 42.3 NW
TT.Time(3) = missing; TT.Temp(3) = missing; TT.WindDirection(3) = missing;
TT
TT=3×2 timetable Time Temp WindDirection ____________________ ____ _____________
18-Dec-2015 08:03:05 37.3 NW
18-Dec-2015 10:03:17 39.1 N
NaT NaN <undefined>
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2017a