Importing large files to double with a "." as a missing value

조회 수: 1 (최근 30일)
Danielle Leblance
Danielle Leblance 2016년 11월 20일
댓글: Danielle Leblance 2016년 11월 20일
I have many large files in excel . I am using the excel import function but the issue is that it shows all columns as cell columns because whenever there is a missing value the cell has a dot "." instead of nan or empty cell. Changing them manually is very tedious. Is there a way to force matlab to import all columns as vector columns while replacing the "." with a nan value?
  댓글 수: 2
KSSV
KSSV 2016년 11월 20일
Have you tried
[num,txt,raw] = xlsread('myfile.xlsx')
Star Strider
Star Strider 2016년 11월 20일
It would be much easier to give you a specific solution if we had your file (or a representative part of it) to work with.

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

채택된 답변

Guillaume
Guillaume 2016년 11월 20일
편집: Guillaume 2016년 11월 20일
Nowadays, there's hardly any reason to use xlsread when readtable can also read excel files and is a lot more powerful.
In your particular case:
mytable = readtable('yourexcelfile.xlsx', 'TreatAsEmpty', '.')
will replace all the '.' by NaN.
edit: fixed typo
  댓글 수: 3
Guillaume
Guillaume 2016년 11월 20일
That was a typo, the parameter was 'TreatAsEmpty'. Note that I did link the doc, so you could just have looked it up.
Danielle Leblance
Danielle Leblance 2016년 11월 20일
thanks . i didn't notice the typo.

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

추가 답변 (1개)

Danielle Leblance
Danielle Leblance 2016년 11월 20일
attached the file. the number of rows in the real file is large

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by