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

4 Ansichten (letzte 30 Tage)
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 Kommentare
KSSV
KSSV am 20 Nov. 2016
Have you tried
[num,txt,raw] = xlsread('myfile.xlsx')
Star Strider
Star Strider am 20 Nov. 2016
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Guillaume
Guillaume am 20 Nov. 2016
Bearbeitet: Guillaume am 20 Nov. 2016
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 Kommentare
Guillaume
Guillaume am 20 Nov. 2016
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 am 20 Nov. 2016
thanks . i didn't notice the typo.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Danielle Leblance
Danielle Leblance am 20 Nov. 2016
attached the file. the number of rows in the real file is large

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by