Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

missing

Create missing values

Syntax

m = missing

Description

example

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, and calendarDuration convert missing to NaN

  • datetime converts missing to NaT

  • categorical converts missing to <undefined>

  • string converts missing to <missing>

Examples

collapse all

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>  

Introduced in R2017a

Was this topic helpful?