www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/MissingValuesinTablewithVariousDataTypesExample.m

    %% Missing Values in Table with Various Data Types  
% Create a table with variables of different data types and find the elements
% with missing values.   

%%  
dblVar = [NaN;3;5;7;9;11];
singleVar = single([1;NaN;5;7;9;11]);
cellstrVar = {'one';'three';'';'seven';'nine';'eleven'};
charVar = ['A';'C';'E';' ';'I';'J'];
categoryVar = categorical({'red';'yellow';'blue';'violet';'';'ultraviolet'});
m = [1:2:10];
dateVar = [datetime(2015,m,15) NaT]';

A = table(dblVar,singleVar,cellstrVar,charVar,categoryVar,dateVar)  

%% 
% |ismissing| returns 1 where the corresponding element in |A| has a missing
% value. 
TF = ismissing(A) 

%%
% The size of |TF| is the same as the size of |A|.