help-octave
[Top][All Lists]
Advanced

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

Re: Octave Limits


From: Daryl Warkentin
Subject: Re: Octave Limits
Date: Fri, 21 Nov 2003 11:14:07 -0600

On Fri, 2003-11-21 at 10:49, Przemek Klosowski wrote:
>    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.

You are right. I was creating the file on a FAT32 partition which is
limited to 2GB. When I create the file on an ext3 partition I seem to
have no limit (at 3.5GB right now and counting) and as an added benefit
it is significantly faster. 

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

Ya, reading the documenation closely would have save me an you both a
few minutes today. Thank you very much for the help.

-- 
Daryl Warkentin, P. Eng.
Hardware Engineering
SED Systems
www.sedsystems.ca



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