xlsread - Reading set number of columns with unknown number of row...
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Oleg Komarov
2011년 8월 5일
Strange, for me it works fine:
xlsread('test.xlsx',1,'A:D')
댓글 수: 5
Franck Dernoncourt
2013년 4월 25일
편집: Franck Dernoncourt
2013년 4월 25일
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
2013년 5월 22일
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!