missing

Create missing values

Syntax

Description

example

m = missingreturns a missing value displayed as. You can set an element of an array or table tomissingto represent missing data. The value ofmissingis 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 supportmissingand their corresponding standard missing values after assignment are as follows:

  • double,single,duration, andcalendarDurationconvertmissingtoNaN

  • datetimeconvertsmissingtoNaT

  • categoricalconvertsmissingto

  • stringconvertsmissingto

Examples

collapse all

Create a timetable containing weather data, and replace the last row with missing values. Eachmissingvalue 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 timetableTime 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 timetableTime Temp WindDirection ____________________ ____ _____________ 18-Dec-2015 08:03:05 37.3 NW 18-Dec-2015 10:03:17 39.1 N NaT NaN 

Introduced in R2017a