table

Methods

Method Reference: table.anymissing

table: TF = anymissing (tblA)

Determine if any table element is missing.

TF = anymissing (tblA) returns true if at least one element in table tblA is missing, otherwise it returns false. TF is a logical scalar value.

Missing values are defined according to the data type of each variable in tblA:

  • NaN - double, single, duration and calendarDuration
  • NaT - datetime
  • <missing> - string
  • <undefined> - categorical
  • {''} - cell arrays of character vectors
  • '' - character arrays

Source Code: table

Example: 1

anymissing is a fast scalar check: true as soon as any element of the table is missing, across every variable and type — NaN for numeric, NaT for datetime, <missing> for string, <undefined> for categorical.

 Name = string ({'Li'; 'Diaz'; 'Brown'});
 Age = [38; 43; 40];
 Grade = categorical ({'A'; ''; 'B'});
 T = table (Name, Age, Grade)
T =
  3x3 table

     Name      Age       Grade       
    _______    ___    ___________    

    "Li"        38              A    
    "Diaz"      43    <undefined>    
    "Brown"     40              B
 anymissing (T)
ans = 1

A table with no gaps of any kind returns false.

 anymissing (table (string ({'Li'; 'Diaz'}), [38; 40]))
ans = 0