Is it possible to use xlsread for multiple ranges ??

3 views (last 30 days)
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??

Accepted Answer

Image Analyst
Image Analyst on 17 Mar 2015
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!