Azzera filtri
Azzera filtri

Importing a large dataset from Excel into Matlab

4 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Titus Edelhofer
Titus Edelhofer il 23 Set 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 Commento
Tom
Tom il 25 Set 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')

Accedi per commentare.

Più risposte (1)

Christian F.
Christian F. il 25 Set 2012
Modificato: Christian F. il 25 Set 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