xlsread - Reading set number of columns with unknown number of row...
2 views (last 30 days)
Show older comments
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)
0 Comments
Answers (1)
Oleg Komarov
on 5 Aug 2011
Strange, for me it works fine:
xlsread('test.xlsx',1,'A:D')
5 Comments
Franck Dernoncourt
on 25 Apr 2013
Edited: Franck Dernoncourt
on 25 Apr 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
on 22 May 2013
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!