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

33 Ansichten (letzte 30 Tage)
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 Kommentare
Steven Lord
Steven Lord am 25 Okt. 2019
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
Amir Darabi Noferesti am 25 Okt. 2019
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi am 1 Nov. 2019
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!

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by