help-octave
[Top][All Lists]
Advanced

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

Re: fread bug in octave 3.8.0?


From: Mike Miller
Subject: Re: fread bug in octave 3.8.0?
Date: Mon, 13 Jan 2014 08:52:17 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jan 13, 2014 at 12:05:01 +0200, Petri Piila wrote:
> Dear All,
> 
> Is there possibly a bug related to function fread in octave 3.8.0 or is this 
> just octave os x problem (I’m running on 10.9 Maverics).
> 
> Demonstration :
> 
> First I save a matrix with fwrite and the try to read it with fread.
> 
> a = ones(4,4);
> f = fopen(“frtest”,”wb”);
> count = fwrite(f,a,”double”);
> fclose(f);
> 
> Now count is 16 as expected.
> 
> f = fopen(“frtest”,”rb”);
> [b,count] = fread(f,[1,Inf],”double");
> fclose(f);
> 
> This works in 3.6.4 but now gives count = 128 and size(b) = [1 17]. First 
> sixteen values are right and the last one is zero. Now count seems to be in 
> bytes as 128/8 = 16
> 
> If I force count to 16 by using [1,16] or [4,4] instead of [1,Inf] I get 
> count = 128 as before  and matrix b is of size 16 or 4,4.
> 
> So, is it intentional that count in fread is now in bytes and why the extra 
> zero in result if I use Inf which used to be handy if I don’t know the size 
> beforehand?

Yes, this bug has apparently been reported and fixed, see

  https://savannah.gnu.org/bugs/?41091

-- 
mike


reply via email to

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