help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Formatting of digits across columns


From: João Rodrigues
Subject: Formatting of digits across columns
Date: Sat, 26 Oct 2013 11:01:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

Dear list members,

I want to write a matrix with real numbers to an ASCII file so that the maximum number of digits is always approximately the same and in each column the number of decimal places is the same.

For example, if n = 4:

17.6        3.01          6.754
70.0        4.27           0.294
196.0      15.03         0.043

I can do something like:

dlmwrite(matrix,"delimiter", "\t", "precision","%10.2f") but then I need to know exactly how many decimal places there will be, and the same value will apply to all columns.

dlmwrite(matrix,"delimiter", "\t", "precision",4) will yield a maximum of 4 digits per entry, but will not fill in the extra digits so that the number of decimal places per column is always the same.

A simple fix, someone?
Thank you,
Joao



reply via email to

[Prev in Thread] Current Thread [Next in Thread]