Variables:
A: 21x1 cell array of character vectors
B: 21x1 double
Values:
Min
-99
Median
14
Max
563
NumMissing
3
C: 21x1 cell array of character vectors
D: 21x1 double
Values:
Min
-99
Median
7
Max
563
NumMissing
2
E: 21x1 double
Values:
Min
-99
Median
14
Max
563
When you import data from a file, the default is for readtable to read any variables with
nonnumeric elements as a cell array of character vectors.
Find Rows with Missing Values
Display the subset of rows from the table, T, that have at least one missing value.
TF = ismissing(T,{'' '.' 'NA' NaN -99});
rowsWithMissing = T(any(TF,2),:);
disp(rowsWithMissing)
A
B
C
D
E
________
___
__________
___
___
{'egh3'}
NaN
{'no'
}
7
7
{'abk6'}
563
{0x0 char}
563
563
{'wba3'}
NaN
{'yes'
}
NaN
14
{'poj2'}
-99
{'yes'
}
-99
-99
{'gry5'}
NaN
{'yes'
}
NaN
21
readtable replaced '.' and 'NA' with NaN in the numeric variables, B, D, and E.
Replace Missing Value Indicators
Clean the data so that the missing values indicated by code -99 have the standard MATLAB®
numeric missing value indicator, NaN.
9 Tables
9-20
A: 21x1 cell array of character vectors
B: 21x1 double
Values:
Min
-99
Median
14
Max
563
NumMissing
3
C: 21x1 cell array of character vectors
D: 21x1 double
Values:
Min
-99
Median
7
Max
563
NumMissing
2
E: 21x1 double
Values:
Min
-99
Median
14
Max
563
When you import data from a file, the default is for readtable to read any variables with
nonnumeric elements as a cell array of character vectors.
Find Rows with Missing Values
Display the subset of rows from the table, T, that have at least one missing value.
TF = ismissing(T,{'' '.' 'NA' NaN -99});
rowsWithMissing = T(any(TF,2),:);
disp(rowsWithMissing)
A
B
C
D
E
________
___
__________
___
___
{'egh3'}
NaN
{'no'
}
7
7
{'abk6'}
563
{0x0 char}
563
563
{'wba3'}
NaN
{'yes'
}
NaN
14
{'poj2'}
-99
{'yes'
}
-99
-99
{'gry5'}
NaN
{'yes'
}
NaN
21
readtable replaced '.' and 'NA' with NaN in the numeric variables, B, D, and E.
Replace Missing Value Indicators
Clean the data so that the missing values indicated by code -99 have the standard MATLAB®
numeric missing value indicator, NaN.
9 Tables
9-20
