How can I extract only 3 columns from a large CSV without running out of memory?

1 view (last 30 days)
Mate 2u
Mate 2u on 13 Apr 2013
I have huge CSV files containing financial trade prices. The CSV files (when opened in excel), show 5 columns. I want to extract only columns 1, 3 and 5 (Date in form of mm/dd/yyyy, prices up to 2 decimal places 51.44 and volume which is a whole number).
As you can understand with only 16GB RAM, I run out of memory very easily when dealing with CSV of sizes 16GB itself (16GB being the extreme example of what I have).
Can anybody tell me how I can extract these 3 columns without running out of memory and show me how to code it?
Randy Souza
Randy Souza on 15 Apr 2013
I restored the original text of this question.
@Mate 2u: If you have a new question please ask it by creating a new question. If you overwrite an existing question, (1) answerers are not likely to find it, and (2) anyone who finds the question in the future will be confused because the answer makes no sense relative to the question.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 13 Apr 2013
Didn't we already discuss this? To recap, read a line at a time and pull out only those numbers on the line that you need, and put them into the smallest variable possible.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!