Error using csvread to import massive excel file

2 views (last 30 days)
I am using csvread to open a excel file in segments because the original file is too large to open in excel. I can open the first portion of the file with the following code:
% determine the number of data points
datapoints = 250000;
nc = 54;
% Calculate the range of data removed frome the csv file
r1 = 4;
r2 = ((datapoints*nc)+r1);
c1 = 0;
c2 = 0;
%gather data from csv file
data1 = csvread(file,r1,c1,[r1,c1,r2,c2]);
However when I manipulate the variables to carry on to the next portion of data using the following code:
% determine the number of data points
datapoints = 100000;
nc = 54;
% Calculate the range of data removed frome the csv file
r3 = ((datapoints*nc)+r2);
c1 = 0;
c2 = 0;
%gather data from csv file
data2 = csvread(file,r2,c1,[r2,c1,r3,c2]);
I get the following error:
??? Error using ==> dlmread at 145 Badly formed format string.
Error in ==> csvread at 54 m=dlmread(filename, ',', r, c, rng);
Error in ==> programtest2 at 51 data2 = csvread(file,r3,c1,[r3,c1,r4,c2]);
Is there a way to solve this issue? Thank you
  1 Comment
per isakson
per isakson on 26 Nov 2015
How large is the file? In your last question you mentioned 1GB. A 1GB csv-file shouldn't be a problem with Matlab. Is it pure numeric?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!