I have a big csv file (6.5millions x 25) and trying to load it to Matlab. I already tried xlsread
, csvread
but can't get satisfying results. I read I can achieve it by using textscan
.
My data looks this way:
date_time;writetime;F1;F2;F3;R1;h12;b12;h_main;
01.01.2016 0:00:01;504910801075;1;1;1;3,94;799;1515;3,877;
01.01.2016 0:00:02;504910802314;1;1;1;3,96;795;1516;3,857;
First row is a header. Others rows are data. All other rows are of the same format.
My code:
fileID = fopen('value1.csv','r');
formatSpec = '%s; \n';
formatSpec1 = '%s%f %f %f %f %f %f %f %f %f %f\n';
A1 = fscanf(fileID, formatSpec);
A2 = textscan(fileID, formatSpec1,'Delimiter',{';', ','});
I read header to A1
it's ok:
A1 =
date_time;writetime;F1;F2;F3;R1;h12;b12;h_main;
And read data to A2
too.
A2 =
{1x1 cell} [5.0491e+11] [1] [1] [1] [3] [94] [799] [1515] [3] [877]
But how to read 3,94
values? Because it can be just 4
or 0,064
value in this column.
Hope at your help!