bugGNU Octave - Bugs: bug #50485, textscan() behavior incompatible...


bug #50485: textscan() behavior incompatible with matlab in case of empty lines

Submitted by:  sergey plotnikov <nul0m>
Submitted on:  Tue Mar 7 17:30:00 2017  
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sun Mar 26 01:54:56 2017, comment #2:

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.

Dan Sebald <sebald>
Tue Mar 7 21:13:32 2017, comment #1:

Confirmed in 4.3.0+ & checked with Matlab r2017a prerelease.

Philip Nienhuis <philipnienhuis>
Project Member
Tue Mar 7 17:30:00 2017, original submission:

textscan seems to ignore the content of the scanned text after an empty line



sergey plotnikov <nul0m>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by sebald (Posted a comment)
  • -unavailable- added by nul0m (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Mar 7 21:13:38 2017philipnienhuisStatusNone=>Confirmed
    Tue Mar 7 21:13:32 2017philipnienhuisRelease4.2.1=>dev

    Back to the top

    Powered by Savane 3.1-cleanup1