'WorkbookActivate' error with xlsread

When I try to read in a csv file with xlsread, I first got an error that the RPC server was unavailable. After some digging around on this site, I added a pause(10) command after xlsread, and now I get this error message:
Error using xlsread
Error registering events. 'WorkbookActivate' is not a valid event name.
I tried saving the csv as a xlsx file. I have tried using readcell and readtable, but they don't capture all of the data that I need from the csv file. I could write what I need with low-level io, but I used to use xlsread all the time, so I don't want to have to abandon that.
This error happens with both matlab R2020a and 2022b. My computer is running Microsoft Excel 2016. Any help is appreciated! Thank you!

1 comentario

Sudarshan
Sudarshan el 7 de Dic. de 2022
For this particular problem, refer to the following link.
There are additional links related to "xlsread" for those who want to learn more.

Iniciar sesión para comentar.

 Respuesta aceptada

Sudarshan
Sudarshan el 5 de Dic. de 2022

0 votos

Hi Gordon,
The “xlsread” function has not been recommended for use since R2019. A possible workaround is to modify your code to use one of the functions “readmatrix” or “readtable”, both of which read XLS files but return a matrix and a table respectively.
Refer to the below documentation for more info on “readmatrix”:
Here are some useful links to where the issue has been discussed in the past.

4 comentarios

Gordon Fox
Gordon Fox el 5 de Dic. de 2022
I finally solved this by disabling the COM add-ins in Excel.
readmatrix does not work because I need the text information in the spreadsheet as well, and I have not been able to get readtable to work yet, because the spreadsheets are not formatted neatly with variable names atop columns of variable data. I need to pull all of the text and numbers of the spreadsheet in and then parse them in Matlab.
The link to the RPC server issue does not help either, because that seems to be referring to another program calling Matlab, not Matlab calling Excel.
Thank you for the link Sudarshan!
Sudarshan
Sudarshan el 6 de Dic. de 2022
Editada: Sudarshan el 6 de Dic. de 2022
Glad that the link helped. Do accept the answer if you found it useful!
Gordon Fox
Gordon Fox el 6 de Dic. de 2022
Sudarshan, so that other users can clearly see what worked, can you please comment with the following link Then, I will accept that as the correct answer. The other links in your post do not solve this particular problem.
Sudarshan
Sudarshan el 7 de Dic. de 2022
Thanks for the suggestion. Added the link to a separate comment.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 2 de Dic. de 2022

Comentada:

el 7 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by