import big csv file with header in matlab

I have a big csv file about(18G), that have few record but so many columns. I don't know how many columns I have. my file have header. I want to import this file in matlab . please help me

1 件のコメント

dpb
dpb 2015 年 8 月 23 日
Matlab is limited in 64-bit version only by available memory theoretically, anyway...

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 23 日

0 投票

You will not be able to use csvread() or dlmread() for it because of the headers. Those two routines cannot be used if there is any text anywhere in the file.
You can use textscan() for this. You can build the format as a string. For example,
numheaderlines = 2; %set as appropriate
numcol = 17104; %set as appropriate
fmt = repmat('%f', 1, numcol);
fid = fopen('YourFile.csv', 'rt');
data = textscan(fid, fmt, 'HeaderLines', numheaderlines, 'Delimiter', ',', 'CollectOutput', 1);
fclose(fid);
Now data{1} would be a giant numeric array.

質問済み:

2015 年 8 月 23 日

回答済み:

2015 年 8 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by