Is it possible to use xlsread for multiple ranges ??

9 ビュー (過去 30 日間)
Alejandro
Alejandro 2015 年 3 月 17 日
コメント済み: Alejandro 2015 年 3 月 17 日
I hope there's an easy answer to this, I'm trying to import some data from a single excel file and also same sheet, but it is not ordered consecutively, so what I did was this:
myRange = get(handles.listbox1,'Value');
myCells = sprintf('AF%d:AF%d',myRange+1, myRange+1);
BTF = xlsread('Section.xls', 1, myCells);
myCells2 = sprintf('AH%d:AH%d',myRange+1, myRange+1);
HTW = xlsread('Section.xls', 1, myCells2);
myCells3 = sprintf('AL%d:AL%d',myRange+1, myRange+1);
ZX = xlsread('Section.xls', 1, myCells3);
myCells4 = sprintf('AR%d:AR%d',myRange+1, myRange+1);
RY = xlsread('Section.xls', 1, myCells4);
myCells5 = sprintf('AU%d:AU%d',myRange+1, myRange+1);
JJ = xlsread('Section.xls', 1, myCells5);
myCells6 = sprintf('AV%d:AV%d',myRange+1, myRange+1);
CW = xlsread('Section.xls', 1, myCells6);
This takes too much time to process and I still need to import more ranges. Any Ideas anyone??

採用された回答

Image Analyst
Image Analyst 2015 年 3 月 17 日
Yes that will take a very long time. What you need to do is to use ActiveX so that you only launch and shutdown Excel once instead of 7 times. See my attached demo.
  1 件のコメント
Alejandro
Alejandro 2015 年 3 月 17 日
Thanks for the help!!!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by