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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by