フィルターのクリア

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

3 ビュー (過去 30 日間)
Adam
Adam 2011 年 8 月 5 日
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)

回答 (1 件)

Oleg Komarov
Oleg Komarov 2011 年 8 月 5 日
Strange, for me it works fine:
xlsread('test.xlsx',1,'A:D')
  5 件のコメント
Franck Dernoncourt
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
Franck Dernoncourt 2013 年 5 月 22 日
More details on the above-mentioned issue here: http://stackoverflow.com/q/16700909/395857

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by