Reading large CSV files with MATLAB
- By : Adnan Vilic
- Category : Code examples
Reading very large CSV files in MATLAB can be extremely slow and may even cause MATLAB to freeze or crash.
A few weeks ago I was trying to read a CSV file of ~300MB, and it took forever to load although I have a fairly good laptop (i7-3537U, 8GB RAM, etc). In my search for faster ways to load, I found a script which I believe was written by Stanisław Adaszewski. Unfortunately, his website ALGOHolic seems to be down, and I haven’t been able to find other places to download his script. I have therefore decided to share his unaltered work. Usage:
quote = '"';
sep = ';';
escape = '\';
[numbers, text] = swallow_csv(filename, quote, sep, escape);
The attached archive contains compiled MEXW64 version. For other OS/architecture you need to:
mex swallow_csv.cpp
No Comments