필터 지우기
필터 지우기

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

조회 수: 9 (최근 30일)
Randy
Randy 2013년 9월 21일
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
Matt J
Matt J 2013년 9월 22일
It doesn't sound normal. Your code, if you show it, could tell us why.
Randy
Randy 2013년 9월 22일
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).

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

답변 (1개)

Matt J
Matt J 2013년 9월 22일
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
Matt J
Matt J 2013년 9월 23일
편집: Matt J 2013년 9월 23일
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 2013년 9월 23일
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.

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

카테고리

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