I have a large Excel file full of numerical data that I am trying to read in the following way:
hExcel = actxserver('excel.application'); hExcel.Workbooks.Open('test.xlsx'); data = hExcel.Worksheets.Item('Sheet1').UsedRange.Value; hExcel.Quit; delete(hExcel)
The data is read correctly when I run the code. However, I obtain the following error if I open an Excel file outside of MATLAB while the code is running:
Error using Interface.000208D7_0000_0000_C000_000000000046/Item Invoke Error, Dispatch Exception: Invalid index. Error in example_actxserver_read (line 4) data = hExcel.Worksheets.Item('Sheet1').UsedRange.Value;
Best Answer