Importing a large dataset from Excel into Matlab

3 views (last 30 days)
Hello together,
I'm trying to import large numerical matrices e.g. [6000 x 6000], which should be no problem since I am running Matlab 64bit with 8gb ram.
However, I always get errors when I try to import the data at once. Is there any way to import the data without splitting it up into smaller pieces?
Best,
Christian

Accepted Answer

Titus Edelhofer
Titus Edelhofer on 23 Sep 2012
Hi Christian,
I'm not sure who is to "blame" that it does not work at once. What kind of error message do you get? Does it come from Excel (the ActiveX server that is employed when reading Excel files) or MATLAB?
What is so bad about importing in pieces, something like
X = zeros(6000, 6000);
for ii = 0:5
data = xlsread('myfile.xlsx', sprintf('A%d:ZZZ%d', ii*1000+1, ii*1000+1000));
X(ii*1000+(1:1000), :) = data;
end
Titus
  1 Comment
Tom
Tom on 25 Sep 2012
If you're going to use XLSREAD multiple times on the same file, it might be worth setting up a COM server* and working that way as it will be much faster (I think XLSREAD opens and closes a server and the file each time which wastes a lot of time)
*e.g.
actxserver('Excel.Application')

Sign in to comment.

More Answers (1)

Christian F.
Christian F. on 25 Sep 2012
Edited: Christian F. on 25 Sep 2012
Hi Titus,
Thanks a lot for your reply. Unfortunately, xlsread doesnt seem to like large files and often returns some memory errors.
Anyway, thanks alot for your code, I will try that.
Best,
Christian

Community Treasure Hunt

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

Start Hunting!