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

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

[Octave-bug-tracker] [bug #46080] Unexpected warning from textscan() whe


From: anonymous
Subject: [Octave-bug-tracker] [bug #46080] Unexpected warning from textscan() when headerlines is 0
Date: Wed, 30 Sep 2015 15:47:27 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0.2 Waterfox/40.0.2

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

                 Summary: Unexpected warning from textscan() when headerlines
is 0
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Wed 30 Sep 2015 03:47:25 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: None
             Assigned to: None
         Originator Name: Ethan Biery
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

If the 'headerlines' property is used as an argument to the textscan()
function, and the value of 'headerlines' is 0, a warning is created:

debug> C=textscan(fid,'%f %f','headerlines',0,'delimiter',['\t' ' ' ',']);
warning: strread: unknown property 'headerlines'
warning: called from
    strread at line 215 column 3
    textscan at line 313 column 5


(This may be the case if the "0" is actually a variable computed elsewhere in
the code.  The current workaround--having to check for a zero value, and
subsequently call textscan() without the headerlines argument--seems
inelegant).

The fix seems simple in textscan.m:

      if (args{headerlines + 1} > 0)
        ## Beware of zero valued headerline, fskipl would skip to EOF
        fskipl (fid, args{headerlines + 1});
        ##REMOVE line from here: args(headerlines:headerlines+1) = [];
        st_pos = ftell (fid);
      elseif (args{headerlines + 1} < 0)
        warning ("textscan.m: negative headerline value ignored");
      endif
      ##ADD line to here: args(headerlines:headerlines+1) = [];



This will clear out the headerlines value during the subsequent call to
strread (eliminating the warning), regardless of whether it's positive,
negative, or zero.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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