필터 지우기
필터 지우기

How to import blanks cells as Nans

조회 수: 10 (최근 30일)
Cristina
Cristina 2015년 4월 27일
댓글: Ahmed Nirjhar Alam 2020년 7월 23일
I have a file (created in excel) with >100k rows and 22 columns. Many of the cells are blanks (not zeros). If I use csvread to import the data Matlab changes the banks to zeros. I cannot first change the blanks to 99999 because excel crashes. Is there a way to make Matlab import the blanks as Nan's?

채택된 답변

Mohammad Abouali
Mohammad Abouali 2015년 4월 27일
a=importdata('sampledata.csv')
a =
1 2 3 4 5
1 2 3 NaN 5
1 NaN 3 4 5
1 2 3 NaN 5
1 2 3 4 5
1 2 3 4 NaN
  댓글 수: 3
Mohammad Abouali
Mohammad Abouali 2015년 4월 28일
you are welcome
Ahmed Nirjhar Alam
Ahmed Nirjhar Alam 2020년 7월 23일
Is there any equivalent substitute for when I have a file with multiple datatypes(such as integers, doubles, strings) in different columns?

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

추가 답변 (1개)

Stephen23
Stephen23 2015년 4월 28일
편집: Stephen23 2015년 4월 28일
Here is a list of some functions that can import blank/missing data as NaN:
and you can find comprehensive lists of all file reading functions in the documentation:

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by