[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Saving variable of type 'file'
From: |
Dmitri A. Sergatskov |
Subject: |
Saving variable of type 'file' |
Date: |
Sun, 19 Jan 2003 22:59:39 -0700 (MST) |
Apparently octave does not like saving variables of type 'file'.
I think it is a feature (one shall not have a valid fid if
actual file has not been opened), but I also think that the way octave
handles it is at least confusing (mostly for 'save -binary'). Here is an
example:
GNU Octave, version 2.1.42 (i686-pc-linux-gnu).
...
octave:1> fid=fopen('00README')
fid =
{
id = 3
name = 00README
mode = r
arch = native
status = open
}
octave:2> t=(1:100);
octave:3> x=sin(t);
octave:4> save -binary test222.bin
warning: save: wrong type argument `file'
octave:5> save -ascii test222.txt
warning: save: wrong type argument `file'
octave:6> save -hdf5 test222.txt
warning: save: wrong type argument `file'
error: save: error while writing `fid' to hdf5 file
octave:6> whos
*** local user variables:
prot type rows cols name
==== ==== ==== ==== ====
rwd file - - fid
rwd range 1 100 t
rwd matrix 1 100 x
octave:7> quit
---
Now if I try to load files back, ascii and hdf5 work fine, but
binary gives an error message (though it does appear to load other
variables correctly):
octave:1> load test222.txt
octave:2> whos
*** local user variables:
prot type rows cols name
==== ==== ==== ==== ====
rwd range 1 100 t
rwd matrix 1 100 x
octave:3> clear *
octave:4> whos
octave:5> load test222.bin
error: load: trouble reading binary file `test222.bin'
octave:5> whos
*** local user variables:
prot type rows cols name
==== ==== ==== ==== ====
rwd range 1 100 t
rwd matrix 1 100 x
----------------------------------------------------
What troubles me is the fact that it gives me an error message
that binary file is corrupted. Though in this example I can
verify that t and x is what expected, I do not know if it is
true in general case.
Sincerely,
Dmitri.
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- GUI help, pand9613, 2003/01/19
- Saving variable of type 'file',
Dmitri A. Sergatskov <=