How to export to excel?

조회 수: 11 (최근 30일)
madhan ravi
madhan ravi 2018년 8월 21일
댓글: madhan ravi 2018년 8월 21일
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
Walter Roberson
Walter Roberson 2018년 8월 21일
"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 2018년 8월 21일
Thank you for the clear clarification Sir Walter

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2018년 8월 21일
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
Walter Roberson
Walter Roberson 2018년 8월 21일
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 2018년 8월 21일
Thank you sirs @Image Analyst & @Walter.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by