Search code examples
excelmatlabloopsxlsread

MATLAB xlsread's cell range changing on each loop


I would like to incorporate an xlsread instruction into a loop running over a list of different years. My intention is that at every loop the cell range changes, in order to import data for the respective year. I would like the cell range to move to the column to the right of the previous cell range. Is there any way to do this?

Thank you for your suggestions!


Solution

  • It's not possible for this to happen automatically.

    Repeated calls to xlsread are very slow. because each one opens an instance of the Excel application. You're better off reading all of the data in one go, then stepping through the resulting array in MATLAB.