MATLAB Answers

Precision in writetable()

조회 수: 26(최근 30일)
madhan ravi
madhan ravi 26 Oct 2020
댓글: madhan ravi 26 Oct 2020
Is there a way to use writetable() to export using only 2 decimals? To be able to directly export it to an excel file.

  댓글 수: 0

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

채택된 답변

dpb
dpb 26 Oct 2020
Sadly, no. A OutputFormat formatting string or NumericPrecision option is not available.
I presume since a table can contain any data type including cells too many possibilities are opened up that TMW hasn't wanted to venture down that road.
Does seem like worthy of some design consideration for the normal cases, though, granted...
For text files, the numeric format is long g.

  댓글 수: 4

표시 이전 댓글 수: 1
dpb
dpb 26 Oct 2020
What's the end objective file target and the data?
Perhaps rounding the data in the table first?
Walter Roberson
Walter Roberson 26 Oct 2020
varfun() with appropriately selected input variables, with @(v) round(v,2) as the function to be applied.
madhan ravi
madhan ravi 26 Oct 2020
Thank you dpb and sir Walter , rounding would be appropriate for my needs.

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

추가 답변(0개)

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by