Effacer les filtres
Effacer les filtres

xlsread - Reading set number of columns with unknown number of row...

3 vues (au cours des 30 derniers jours)
Adam
Adam le 5 Août 2011
If I use xlsread with no range it takes 45 sec to read file and returns n cols x 65k rows for my file.
If I read just the columns I need by 65k it takes 20 sec to read the data I need.
Every workbook and every sheet in workbooks have a different unknown number of rows of data. So for efficient processing I would like to read columns A:D all rows for every sheet I have to process, without having to look at each sheet interactivly.
If I look at the file, there are 65k rows, if I use the active x to find the number of rows, it returns 65k as the end row. However reading the data I need with the activex takes longer than reading with xlsread and no range.
The solution would be to use xlsread and just specify the col information. (ie read a single col by specifing range C:C. However when I do this xlsread returns over a million rows of data not the 65k that are in the file. This causes a not enough store error.
Is there a way to get the faster xlsread to work properly? Adam (2011a)

Réponses (1)

Oleg Komarov
Oleg Komarov le 5 Août 2011
Strange, for me it works fine:
xlsread('test.xlsx',1,'A:D')
  5 commentaires
Franck Dernoncourt
Franck Dernoncourt le 25 Avr 2013
Modifié(e) : Franck Dernoncourt le 25 Avr 2013
I have the same issue. Here is an example of a file causing the issue: http://www9.zippyshare.com/v/67423126/file.html
The file has only 272 rows, but using [~, ~, temp] = xlsread('1.csv','A:A'); temp will have dimension 1048576x1.
Any idea what is causing this issue? I use Win7 + MATLAB 2012a
I have no issue when using textscan:
fid = fopen('1.csv','r');
datatemp = textscan(fid, '%s %d %d %d %s %s %s %s %s %d %d', 'delimiter',',', 'CollectOutput',true, 'headerLines', 1)
fclose(fid);
Franck Dernoncourt
Franck Dernoncourt le 22 Mai 2013
More details on the above-mentioned issue here: http://stackoverflow.com/q/16700909/395857

Connectez-vous pour commenter.

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by