xlsread: NaN is not recognized as Numeric Data

조회 수: 1 (최근 30일)
chris_andreas
chris_andreas 2016년 6월 23일
댓글: brian zhang 2020년 7월 17일
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
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.

댓글을 달려면 로그인하십시오.

채택된 답변

chris_andreas
chris_andreas 2016년 7월 4일
Hi! I found a solution: With the function "importdata" the data is imported the "right" way.

추가 답변 (2개)

dpb
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.

Muhammad Usman Saleem
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

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by