Increasing decimal point precision

Hello, I'm working on a project to read data from a certain type of file and output it into a properly formatted CSV file. I have everything working properly, but the outputs aren't to the precision I would require. While debugging I can see that the matrix elements contain the data to the necessary precision, the output just isn't following this. For example, in the matrix M, element M(1,1) = 5.5860e+04, but when highlighted I can see the full value of 5.586023447564540e+04. When I write the data out using:
dlmwrite(output_file, M, 'precision', '%15.10f', 'precision', 5, 'precision', 10, 'precision', 10,'precision', 6, 'precision', 6, 'precision', 6, 'precision', 6, 'precision', 6, 'precision', 6, 'newline', 'pc', '-append');
The value shows up as 55860.2 in the .csv. I thought I had understood the C-style formatting strings and dlmwrite function, but it seems that I don't. If it helps, M is a n by 10 matrix, but only the first column needs further formatting.
Thank you for your help!
Kevin V.

 採用された回答

Walter Roberson
Walter Roberson 2012 年 3 月 14 日

1 投票

You cannot have multiple "precision" arguments in dlmwrite()

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by