How to export to excel?

10 vues (au cours des 30 derniers jours)
madhan ravi
madhan ravi le 21 Août 2018
Commenté : madhan ravi le 21 Août 2018
Hi everyone, I just installed excel(2016) in my Mac so I tried the below code just then it shows the following error.
ans =
1.6629028619989176615049162203409
xlswrite('a.xls','ans')
Warning: Could not start Excel server for export. XLSWRITE will attempt to write file in CSV format.
  7 commentaires
Walter Roberson
Walter Roberson le 21 Août 2018
"xlswrite command won't work even if excel is installed?"
xlswrite() cannot communicate directly with Excel, except on MS Windows that has MS Office installed. COM object support is not compiled into the Mac version of Excel, so even if you were to install one of the COM libraries for Mac, it would not be possible to communicate with Excel that way.
This is a Microsoft restriction.
madhan ravi
madhan ravi le 21 Août 2018
Thank you for the clear clarification Sir Walter

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 21 Août 2018
That's normal for a Mac. Also, you'll probably see a in one cell, n in the next cell to the right, and s in the next cell to the right. If you want the string 'ans' to go in as a string into one cell, put it in braces:
xlswrite('a.xlsx', {'ans'})
If you want the number 1.662 to go in, use ans without quotes
xlswrite('a.xlsx', ans)
  4 commentaires
Walter Roberson
Walter Roberson le 21 Août 2018
We can tell from the number of digits in your variable a that your variable is class sym. You will need to use
xlswrite('a.xls', double(a))
If you were on Windows with Office installed then another option would be
xlswrite('a.xls', char(a))
Note that this will not have any effect on the fact that xlswrite on Mac or Linux can only write in csv format. There is no way to get around that fact. It is quite unlikely that Microsoft will ever create a version of Office for Mac that supports the COM interface that xlswrite() needs to be able to write in xls or xlsx format.
madhan ravi
madhan ravi le 21 Août 2018
Thank you sirs @Image Analyst & @Walter.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by