xlswrite is truncating the values from the input matrix to the output files
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Kirby Fears
on 29 Sep 2015
Edited: Kirby Fears
on 29 Sep 2015
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 Comments
Kirby Fears
on 29 Sep 2015
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.
More Answers (2)
Ariel Steele
on 24 Sep 2019
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 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!