xlsread: NaN is not recognized as Numeric Data
1 次查看(过去 30 天)
显示 更早的评论
I like to import data from the file 'test.csv' (see attachment) into matlab. I use following code:
[Data, Time] = xlsread('test.csv')
Problem: The numeric data that is returned doesn't include the NaN data from the first rows. It looks like that xlsread doesn't include the NaN data if the whole row consists only of NaN Data. For my routine the NaN data from the first rows needs to be returned also.
Thx for your help. Chris
1 个评论
brian zhang
2020-7-17
try to convert data to string you will get NaN not a number. I bet convert back to number will not be 'NaN'. Logic return will be 0 which is an error.
采纳的回答
更多回答(2 个)
dpb
2016-6-23
My release of Excel doesn't have NaN as a numeric entity; suspect it's not being returned because it isn't numeric. Look at the alternate outputs of xlsread, text, and raw. You'll likely have to process the raw text array.
0 个评论
Muhammad Usman Saleem
2016-6-23
convert this csv file into excel. Then try to read
xlsread('test.csv')
or you have another option if NAN values are not read by xlsread. Change in csv file NaN value with arbitary value like -999999 then try to read them. After then you can change this value with NaN as
find(data=-999999)=nan;
tell me please
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!