xlswrite error in MATLAB R2018b

45 visualizaciones (últimos 30 días)
Rene Labounek
Rene Labounek el 6 de Mayo de 2019
Comentada: Walter Roberson el 6 de Mayo de 2019
I have an issue with exporting result to xlsx file at MATLAB R2018b installed at Ubuntu 18.04.2 LTS. I have tried a code directly from the MATLAB help and I am getting the same error:
filename = 'testdata.xlsx';
A = {'Time','Temperature'; 12,98; 13,99; 14,97};
sheet = 2;
xlRange = 'E1';
xlswrite(filename,A,sheet,xlRange)
The error is:
Warning: Unable to write to Excel format, attempting to write file to csv format. To write to an Excel file, convert your data to a
table and use writetable.
> In xlswrite (line 179)
Error using xlswrite (line 192)
An error occurred on data export in CSV format.
Caused by:
Error using dlmwrite (line 104)
The input cell array cannot be converted to a matrix.
Any idea how to fix it?
Kind regards and thanks,
Rene

Respuestas (1)

Jan
Jan el 6 de Mayo de 2019
What about the hint given in the error message:
To write to an Excel file, convert your data to a table and use writetable.
  1 comentario
Walter Roberson
Walter Roberson el 6 de Mayo de 2019
To expand a bit:
xlswrite() is only capable of writing .csv files on Mac and Linux, and on MS Windows systems that do not have Excel installed. MATLAB for Mac and Linux do not provide the interface calls that are used to talk to Excel directly, and it would not matter if they did have it because the interface used is not compiled into Excel for Mac (and Excel does not exist for Linux.)
However, starting R2013b, writetable() has been able to create .xls and .xlsx .

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by