bugGNU Octave - Bugs: bug #46080, Unexpected warning from textscan()...


bug #46080: Unexpected warning from textscan() when headerlines is 0

Submitter:  None
Submitted:  Wed 30 Sep 2015 03:47:25 PM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Ethan Biery Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.0.0
Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Fri 02 Oct 2015 03:33:03 PM UTC, comment #5: 
Philip Nienhuis <philipnienhuis>
Project Member
Thu 01 Oct 2015 08:43:31 PM UTC, comment #4: 

Update cs to contributors.in attached.

(file #35029)

Philip Nienhuis <philipnienhuis>
Project Member
Thu 01 Oct 2015 08:35:57 PM UTC, comment #3: 

Fixed in this cs:

I'll make a different cs for the contributors list.


Philip Nienhuis <philipnienhuis>
Project Member
Thu 01 Oct 2015 07:09:02 PM UTC, comment #2: 

OK I have a fix ready along the lines you sketched, also for textread that has the same code.

Would you like to be credited and have your name mentioned in the list of contributors? If yes would you object to your email being mentioned in the patch?

Philip Nienhuis <philipnienhuis>
Project Member
Thu 01 Oct 2015 04:48:34 PM UTC, comment #1: 

I think your suggestion makes sense.

I'll look into it

Philip Nienhuis <philipnienhuis>
Project Member
Wed 30 Sep 2015 03:47:25 PM UTC, original submission:  

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");
      ##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.



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

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.





    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-10-01 philipnienhuis Attached File- Added contributors_EthanBiery.cs, #35029
    2015-10-01 philipnienhuis StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2015-10-01 philipnienhuis StatusConfirmed In Progress
    2015-10-01 philipnienhuis Operating SystemMicrosoft Windows Any
    2015-10-01 philipnienhuis StatusNone Confirmed
        Assigned toNone philipnienhuis

    Back to the top

    Powered by Savane 3.9