octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #43613] fread() with a vector size doesn't ret


From: anonymous
Subject: [Octave-bug-tracker] [bug #43613] fread() with a vector size doesn't return a shortened matrix when it hits EOF
Date: Fri, 14 Nov 2014 15:59:40 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0

URL:
  <http://savannah.gnu.org/bugs/?43613>

                 Summary: fread() with a vector size doesn't return a
shortened matrix when it hits EOF
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 14 Nov 2014 03:59:39 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Regression
                  Status: None
             Assigned to: None
         Originator Name: ziser
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

If I create a file with a few bytes, as in:


$ echo -n abcd > myfile


and then try to read a "too big" matrix from that file in Octave, as in:


> fid = fopen( 'myfile', 'r' )
> fread( fid, [2, 3], 'char' )


then the result I get should be:


97    99
98   100


for compatibility with Matlab and previous versions of Octave (in particular,
this seems to work fine with Octave 3.6.1).  But instead, in 3.8.1, I get the
following:


97    99    0
98   100    0


where the matrix has apparently been zero-padded to the size I requested
rather than being short to indicate that not all the columns I requested were
available in the file.

Note that this problem does not seem to occur when the size I pass Octave is a
scalar, i.e. 6 instead of [2, 3].  In that case, Octave returns a short vector
rather than zero-padding.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43613>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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