help-octave
[Top][All Lists]
Advanced

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

Re: Octave Limits


From: Przemek Klosowski
Subject: Re: Octave Limits
Date: Fri, 21 Nov 2003 11:49:42 -0500 (EST)

   I am attempting to write some test data to a file and have bumped into
   the 2GB file size limit. Is there a really good reason why this limit
   exists other than maybe no one has gotten around to updating the code?

I didn't check, but if you keep writing values to a file (as opposed
to creating a 2GB+ array in octave), you should be able to write files
limited only by the underlying file system---it is not an octave
issue; maybe no one has gotten around to updating the filesystem to
one that allows large files.  Please say more about how you bumped
into the 2GB limit.

   Secondly, when I write values to a file they seem to take up way too
   much space and they can't be read properly. Below is an example script
   that shows what I mean.

   octave:1> datafile=fopen('./datafile.dat', 'w+', 'native');
   octave:2> a = [0.1:0.1:1];
   octave:3> fwrite(datafile, a, 'double', 'native');
   octave:4> b=fread(datafile, length(a), 'double', 0, 'native');
   octave:5> b
   b = [](0x1)
   octave:6> fclose(datafile);
   octave:7> version
   ans = 2.1.51

   The file datafile.dat is 1180 bytes in length. I would have expected it
   to be 8bytes * the length of 'a' = 80bytes. Also, fread didn't seem to
   read back anything.


There are several issues here:

 - fwrite needs a 'skip' argument: fwrite(datafile, a, 'double',0, 'native');

 - when you fwrite, your file pointer is at the end of the file, so
   fread will not read anything. If you fclose() and fopen(), it works.
   fseek() should work, too.

 - on my system (linux, octave 2.1.34) the file size is 80 bytes.


   



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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