readmatrix is no longer able to read specific sheets using an integer that represents the location of the sheet (starting MATLAB 2019b)

23 次查看(过去 30 天)
I used this code to load specific sheets from my excel file into MATLAB.
index=readmatrix('Frequency Sweep.xlsx','Sheet',i,'Range',sprintf('A%d',start));
this would load data from sheet number " i ". But since I have updated to MATLAB 2019b, this code doesn't work anymore and it only calls the data from the first sheet.
Does anyone know how to fix this?
Thank you
  2 个评论
Steven Lord
Steven Lord 2019-10-25
Can you answer these questions?
  1. How many sheets Frequency Sweep.xlsx has?
  2. What value you're using for i?
  3. What value you're using for start?
  4. What OS are you using?
Amir Darabi Noferesti
I have attached the excel file. It has 10 sheets and "i" is in a for loop, starting from 1 to 10.
"start" is also where the data starts in the spreadsheet, which is 63.
My OS is windows 10, 64-bit version 1903.
I just ran the same code in MATLAB 2019a and it worked. I guess there is something wrong with the newer version.

请先登录,再进行评论。

回答(1 个)

Vinai Datta Thatiparthi
Hey Amir!
Use the UseExcel parameter to get your expected output. From R2019b revision of MATLAB, UseExcel is also used as a logical value that specifies weather or not to read the spreadsheet file using Microsoft ® Excel ® for Windows ®.
index=readmatrix('Frequency Sweep.xlsx','UseExcel',1,'Sheet',i,'Range',sprintf('A%d',start));
If you wish to read further on how to work with readmatrix, enter this command in the command window -
help readmatrix
Hope this helps!

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by