Borrar filtros
Borrar filtros

How to import blanks cells as Nans

10 visualizaciones (últimos 30 días)
Cristina
Cristina el 27 de Abr. de 2015
Comentada: Ahmed Nirjhar Alam el 23 de Jul. de 2020
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?

Respuesta aceptada

Mohammad Abouali
Mohammad Abouali el 27 de Abr. de 2015
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 comentarios
Mohammad Abouali
Mohammad Abouali el 28 de Abr. de 2015
you are welcome
Ahmed Nirjhar Alam
Ahmed Nirjhar Alam el 23 de Jul. de 2020
Is there any equivalent substitute for when I have a file with multiple datatypes(such as integers, doubles, strings) in different columns?

Iniciar sesión para comentar.

Más respuestas (1)

Stephen23
Stephen23 el 28 de Abr. de 2015
Editada: Stephen23 el 28 de Abr. de 2015
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:

Categorías

Más información sobre Standard File Formats en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by