Why do I receive an error (error code: 0x800A03EC) when using XLSWRITE in MATLAB?
29 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 27 Fév 2013
Modifié(e) : MathWorks Support Team
le 30 Avr 2021
When I use XLSWRITE I get the following error:
ERROR: ??? Error using ==> xlswrite
Error: Object returned error code: 0x800A03EC
Réponse acceptée
MathWorks Support Team
le 30 Avr 2021
Modifié(e) : MathWorks Support Team
le 30 Avr 2021
There are a number of reasons this error is returned from Microsoft Excel -- the most common is when the user attempts to write data larger than Excel can handle. For example, if you try to write a string longer than 1024 characters to a cell in Excel.
The limits of Microsoft Excel are listed here:
This error is also encountered when a cell that is being exported to Excel has a data field of size 0 x N, where N is an integer.
The following command:
s = size(cell1{1});
will return
s = [0 11]
when the cell contains a 0 x N value.
Another situation that results in this error is when a sheetname containing a colon (:) character is used. For example, the following command returns this error:
xlswrite('test.xls', 'sometext', 'January:February', 'A1');
Finally, the error may be produced when attempting to provide an invalid argument to the fourth 'Range' argument of the XLSWRITE command. XLSWRITE only explicitly supports ranges specified using Excel's 'A1' notation.
If you are iteratively writing to spreadsheet cells in a loop, and using the loop variable in the range argument of XLSWRITE, the NUM2STR function must be used to convert the numeric loop variable to a string for the error not to occur. For example:
for i = 1:10
xlswrite('foo.xls',A,'Sheet1',['A' num2str(i)]);
end
Another cause for this error is the use of more than 256 colums:
A = [1:257;1:257];
xlswrite('data1.xls',A)
We might also encounter this error when attempting to write to spreadsheets which are protected. Spreadsheets and workbooks can be made protected using the "Protect Sheet/Workbook" option on the "Review" ribbon in the excel sheet.
The limits for Excel 2010 have changed. The XLSWRITE COM interface sometimes will return this error message. As a potential workaround, please consider the script mentioned in the following solution link as an alternative way to write to Excel:
0 commentaires
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!