Increasing decimal point precision

1 view (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Mar 2012
You cannot have multiple "precision" arguments in dlmwrite()

More Answers (0)

Community Treasure Hunt

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

Start Hunting!