Effacer les filtres
Effacer les filtres

Importing a large dataset from Excel into Matlab

4 vues (au cours des 30 derniers jours)
Christian F.
Christian F. le 23 Sep 2012
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

Réponse acceptée

Titus Edelhofer
Titus Edelhofer le 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 commentaire
Tom
Tom le 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')

Connectez-vous pour commenter.

Plus de réponses (1)

Christian F.
Christian F. le 25 Sep 2012
Modifié(e) : Christian F. le 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!

Translated by