Borrar filtros
Borrar filtros

Why does Matlab need so much memory to read in a .csv file?

9 visualizaciones (últimos 30 días)
Randy
Randy el 21 de Sept. de 2013
I have a 370mb .csv file that I want to read in to Matlab. I cannot do it, because the program sequesters all of my available memory (approximately 5gb) and is still not done with the import. This is as large file, but it is not that big. Is this normal?
  2 comentarios
Matt J
Matt J el 22 de Sept. de 2013
It doesn't sound normal. Your code, if you show it, could tell us why.
Randy
Randy el 22 de Sept. de 2013
My "code" consists of hitting "import data", browsing to the file, selecting the vectors I want from the preview, and hitting "import selection". I do not know what code this runs (it does not show up in the command history).

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 22 de Sept. de 2013
Just a guess, but if your file is full of numeric data, each data value can become about 8 times as large when converted from text to doubles. Seeing your actual code would provide more clues, though, as I commented above.
  3 comentarios
Matt J
Matt J el 23 de Sept. de 2013
Editada: Matt J el 23 de Sept. de 2013
If your file is 370MB and contains 20 million elements, it means that each element consumes about 18 bytes on average. That sounds a bit weird to me. Are these 18 digit numbers?
Anyway, you could try xlsread, dlmread, or textscan to see if you can read 1 column at a time and see if it makes a difference.
Image Analyst
Image Analyst el 23 de Sept. de 2013
18 bytes per number is fine. Each number could be 18 characters if it had, say for example, 3 numbers, a decimal place, 12 digits of mantissa, a comma, and a trailing space, like this "123.123456789012, " That's 18 ASCII characters and if there were about 20 million ASCII sequences like that in the CSV text file, you'd get 370 MB.

Iniciar sesión para comentar.

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by