Precision in writetable()
古いコメントを表示
Is there a way to use writetable() to export using only 2 decimals? To be able to directly export it to an excel file.
採用された回答
その他の回答 (2 件)
Johannes Kalliauer
2022 年 7 月 20 日
編集済み: Johannes Kalliauer
2022 年 7 月 20 日
0 投票
dlmwrite('yourfile.txt',t{:,:},'\t','precision','%10.2f')
1 件のコメント
dpb
2022 年 7 月 20 日
Doesn't get OP directly to Excel as per request, though...but correct that it does allow the formatting string.
Christine
2025 年 2 月 12 日
Another workaround might be executing this line for the variables inside the table.
variable = round(variable*100)/100;
2 件のコメント
Instead of
round(pi*100)/100
use
round(pi,2)
Another I've seen has been
str2double(sprintf('%.2f',pi))
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!