help-octave
[Top][All Lists]
Advanced

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

precision of values stored when using save()


From: Tim Rueth
Subject: precision of values stored when using save()
Date: Thu, 30 Sep 2010 13:01:32 -0700

I am using the save() function to store a matrix in a file, which will later get loaded using load() by another program.  I'd also like the format of this file to be human-readable, which it is already, except that the precision that save() uses is far greater than needed, and makes the matrix hard to read by a human.  Some of the elements of this matrix show 16 decimals of precision, when I only need 2.
 
So, I thought I'd do:
 
        var1 = round(var1 * 100) / 100;
 
for each variable, but save() still stores all 16 digits in those cases.  Any ideas of how to format elements saved using save()?  I could do fopen/fdisp/sprintf..., but then that makes it more complicated to read back all the data into the next program.  Save() and load() are perfect for this.
 
Thanks,
 
--Tim

reply via email to

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