Error while using xlswrite

I am running Matlab 2014b in my Ubuntu 14.04 desktop. I have an xlswrite command in my piece of code. On running it, I get the message that cannot connect to excel server, attempting to write in csv format. However, even a csv format file doesn't come up. The expected file has ~45000 rows and 6 columns. The same piece of code works quite fine, without any error and gives the desired output in a Windows machine. Earlier codes having xlswrite have worked on my Ubuntu machine with the same error/warning message too and in those cases I actually got a csv file. Can someone please suggest me a solution? Thanks

Respuestas (1)

Stephen23
Stephen23 el 24 de Jun. de 2015
Editada: Stephen23 el 24 de Jun. de 2015

0 votos

For more robust and portable code you should use csvwrite or dlmwrite instead.
xlswrite is dependent on Excel for Windows® and its COM server (part of the typical installation of Excel), and so its behavior is really quite system dependent. This is described in the documentation.

3 comentarios

Suchetana Gupta
Suchetana Gupta el 24 de Jun. de 2015
Editada: Suchetana Gupta el 24 de Jun. de 2015
Hi Stephen I replaced xlswrite with csvwrite and still got the following error:
Error using dlmwrite (line 118) The input cell array cannot be converted to a matrix.
Error in csvwrite (line 43) dlmwrite(filename, m, ',', r, c); }^H ^G I used csvwrite in my code as
x1_sheet(any(cellfun(@isempty,x1_sheet),2),:) = []; csvwrite('pr-all-x1-auto.csv',[header;x1_sheet]);
I am still getting the error.
Please suggest a solution.
The same code with
x1_sheet(any(cellfun(@isempty,x1_sheet),2),:) = []; xlswrite('pr-all-x1-auto.xls',[header;x1_sheet]);
is working like a charm on a Windows machine
Stephen23
Stephen23 el 24 de Jun. de 2015
Editada: Stephen23 el 24 de Jun. de 2015
It makes our lives easier if you format code properly on this forum, you can use the {} Code button that you will find above the textbox.
Please post your exact code that you are using to save the data with, and some sample data for us to try.
Note the csvwrite documentation clearly states it does not support mixed character and numeric data, so you cannot use it with a header: the data must be pure numeric. If you need a header, then you can use low-level functions to write your own file-writing function.
Suchetana Gupta
Suchetana Gupta el 27 de Jun. de 2015
Well, I solved my problem by using xlwrite function from Matlab Central.

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 24 de Jun. de 2015

Comentada:

el 27 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by