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

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

[Octave-bug-tracker] [bug #50485] textscan() behavior incompatible with


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #50485] textscan() behavior incompatible with matlab in case of empty lines
Date: Sat, 25 Mar 2017 21:54:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #2, bug #50485 (project octave):

I can describe what is wrong (fixing is another matter).

There is a function called textscan::read_format_once() which reads one line
of of delimited fields, and this is in a loop until either N-times or
indefinite (-1).  The code breaks out of that loop if there was an error. 
There is an error, which is "nothing worked", but it is a bogus error because
in fact there were two successful reads on the first line.

And that is what is missing from the code.  There should be either some return
value, or some means of deducing that textscan::read_format_once() did
actually do something.  Instead, the decision is solely based upon is.fail(). 
So, yes there was a fail (i.e., the third element of '2,1,'), but it's also
true there were some successes (and one might even want to consider the NaN a
success).

Simply oversight, but this goes pretty deep into multiple function calls, so I
think this one would take time to fix and is a summer project sort of thing. 
NaN needs to be handled properly and some means of avoiding the bogus error
needs to be implemented.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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