xlsread Error: Object returned error code: 0x800A03EC
28 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Anna Maria Soriani
le 18 Nov 2020
Commenté : Adam Head
le 14 Jan 2021
Good morning,
I know there are a few questions already answered on this topic, but my problem is a little different and I've tried all the possible solutions given in those threads.
I am using Matlab R2020b, which should be the latest version. I wrote a script months ago which was using xlsread to read from excel spreadsheets that were in the csv format. That worked good and i managed to import all data and make all the analysis. After months I re-opened the file and run it. This is the error it gives me:
Error using xlsread (line 257)
Error: Object returned error code: 0x800A03EC
and the code is
files=dir('C:\Users\Name\Folder1\Folder2\Folder3\*.csv'); % Identifies the .csv files of the specified folder
for i=1:sum(~cellfun(@isempty,{files.name}))
[~, ~, excel{i}]=xlsread(fullfile(files(i).folder,files(i).name));
parameters{i} = excel{i}(1,:);
namestruct{i}=strcat('M',files(i).name(1:end-4));
data.(namestruct{i}) = cell2mat(excel{i}(2:end,:));
end
I want to specify that nothing has changed, neither the extension of Excel files, nor the Matlab version. I also tried to use the function in a much more simpler script, where excel file was just a column and placed in the same folder as the script, and without a for loop.
I also know that is now advised to use readtable function, but I have ten different scripts that uses xlswrite function which was very useful for me and I don't want to change them.
Does anybody know why this function is not working anymore for me?
0 commentaires
Réponse acceptée
Maadhav Akula
le 20 Nov 2020
Hi Anna,
"xlsread" communicates with an Excel COM automation server. Communicating with COM is not 100% reliable. The error message means that there are some issue during communicating with COM and it is difficult to debug.
This is one of the reason that we recommend using "readtable" or "readmatrix" because these two functions will default to NOT using a COM server to read Excel files.
Hope this helps!
2 commentaires
Adam Head
le 14 Jan 2021
Hi Maadhav,
I have the same problem. Your answer was not a solution, i'm afraid. I also use xlsread in my code. It was working a few months back and now it is not. I also think this is because of an update/ change in Matlab's functions or Microsoft Office. I would need a better explanation than to "use another function".
If you don't have a troublshooting option then I will go through the university channels.
Thanks,
Adam
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!