readtable excel decimal NaN
显示 更早的评论
I use readtable to get access to excel data
some cells in the excell file contain no data and instead have a decimal point,
how can I replace these cells with NaN
regards
Johannes
2 个评论
Ameer Hamza
2020-11-5
Can you show how these values are loaded in MATLAB?
Johannes Deelstra
2020-11-5
回答(1 个)
Priysha LNU
2020-11-11
Hi,
Try using the following code:
[m,n] = size(Data) %gives number of rows and columns in 'Data'
for i = 1:m
for j = 1:n
if strcmp(Data{i,j},'.') %check if cell content is "."
Data{i,j} = NaN %replace with NaN
end
end
end
DISCLAIMER: These are my own views and in no way depict those of MathWorks.
类别
在 帮助中心 和 File Exchange 中查找有关 Spreadsheets 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!