[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fread bug in octave 3.8.0?
From: |
Petri Piila |
Subject: |
fread bug in octave 3.8.0? |
Date: |
Mon, 13 Jan 2014 12:05:01 +0200 |
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?
Regards,
Petri Piila
- fread bug in octave 3.8.0?,
Petri Piila <=