[Top][All Lists]

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

Re: Save-load problem

From: John W. Eaton
Subject: Re: Save-load problem
Date: Tue, 29 Apr 2003 13:33:48 -0500

On 29-Apr-2003, Henry F. Mollet <address@hidden> wrote:

| But I still don't understand. If it were a matter of loosing precision,
| would not the elements of vector A be a little different.

The problem is that for a range, the base, limit, and increment of the
range are stored instead of all the individual elements.  Then when
you load the file with this information and recompute the size, Octave
has to recompute the size given the numbers read from the file.  If
they are off slightly, you can generate a different number of

The following worked for me:

  save_precision = 16
  A = 0:pi/16:8*pi;
  save foo.dat A
  load foo.dat
  size (A)  ==> 1, 129.

but this is not a very good solution (you might also be able to get
bad results if you use a value for save_precision that is too large).

At this point, probably it would be best for Octave to default to a
binary format.  I don't think it makes sense to save all elements of
the range, but if that's what you want, I think you will have to
either modify Octave or use the Matlab binary format which I don't
think supports ranges as a special case.

I like the space savings that are possible by representing ranges
using the base, limit, and increment, and it would be nice to preserve
that when saving and loading files, but perhaps when saving in ASCII,
it would be best to convert to matrices.



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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