
xlswrite is truncating the values from the input matrix to the output files
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I'm having a problem with xlswrite truncating the matrix for after output to 5 decimal places. Unfortunately I need more than that, 9 probably.
I've seen some previous discussions of this here and the consensus seems to be that it's not xlswrite's problem. A demand for a screenshot is usually made. I have provided one showing the matrix (finalRaw) on the left, and the excel output on the right. I am calling the function using:
xlswrite('output.xls',finalRaw(:,:));
Please let me know if there's a way to get more precision out of this function.
James

댓글 수: 0
채택된 답변
Kirby Fears
2015년 9월 29일
편집: Kirby Fears
2015년 9월 29일
Hi James,
There's no reason xlswrite would truncate your values.
In Excel, try clicking a "truncated" number -- the formula bar should show the non-truncated value. This would indicate that the Excel display settings are your problem.
Your screenshot is helpful, but maybe you can also post a screenshot showing the excel formula bar after selecting one of these truncated numbers. I'm attaching an example with the formula bar circled.

Also, if you want to reference an entire array you don't need to use ":" in each dimension. Saying finalRaw(:,:) is equivalent to saying finalRaw without indexing.
Hope this helps.
댓글 수: 5
Kirby Fears
2015년 9월 29일
There are some community-made functions that write to excel using Java libraries instead of a COM server. If you really want to write to Excel format, you can try running xlwrite .
I've used it successfully in the past.
추가 답변 (2개)
Ariel Steele
2019년 9월 24일
I had this same problem, and the error that James mentions about MATLAB having to write to CSV instead of Excel is precisely the problem. Convert the array to a table then write the table to Excel. The correct number of digits will be used.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

