bugGNU Octave - Bugs: bug #45047, textread.m: n lines used as repeat...

 
 

bug #45047: textread.m: n lines used as repeat count in strread

Submitter:  None
Submitted:  Thu 07 May 2015 04:09:37 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 24 May 2015 09:08:33 PM UTC, comment #5: 

Fixed textscan.m here along OP's suggestion:
http://hg.savannah.gnu.org/hgweb/octave/rev/1b4bef838aaf

closing report

Philip Nienhuis <philipnienhuis>
Group Member
Sun 24 May 2015 08:59:44 PM UTC, comment #4: 

Fixed in this cs:
http://hg.savannah.gnu.org/hgweb/octave/rev/481fa65e5cab

It all took a bit more than I expected, as I found a other bugs.

textscan.m has the same issues so I fixed them there as well. As textscan.m, when reading from file, must preserve a file pointer position it makes sense to indeed interpret N as the number of lines to read and follow your suggestion. That part of the fix is still pending however.

I hope the info header +the added examples (esp. the last example) make it more clear now about how 3rd input arg. N is to be interpreted.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 20 May 2015 08:44:49 PM UTC, comment #3: 

In the course of fixing this bug I hit another concealed bug in strread.m that I fixed here:
http://hg.savannah.gnu.org/hgweb/octave/rev/eae5e4d58740

Philip Nienhuis <philipnienhuis>
Group Member
Mon 18 May 2015 06:36:04 PM UTC, comment #2: 

@OP: in principle you're right, but the issue lies a bit deeper.

Currently it is as Matlab compatible as can reasonable be (except for another related bug I saw in strread.m), in the sense that for format strings referencing at most one line of the data file it is fully ML-compatible.
For format strings referring to more lines, some 2-way communication is required between strread.m and textread.m (& textscan.m); I had such a beast working some years ago but it was ugly code and hard to maintain so I opted for the current solution.

Anyway I think that I'd rather clarify the help text than follow your suggestion.

In the mean time I spotted a few other issues. I'll look into all of it (incl. bug #45046) a little later this week.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 08 May 2015 11:31:52 AM UTC, comment #1: 

Unless someone picks this up earlier, I'll look into this after May 20 at the earliest (due to trip abroad).

Philip Nienhuis <philipnienhuis>
Group Member
Thu 07 May 2015 04:09:37 PM UTC, original submission:  

"The optional input n specifies the number of data lines to read; in this sense it differs slightly from the format repeat count in strread."

While n is being utilized as the nlines argument in textread it is also being passed into strread as the repeat count since the argument is never removed from varargin.

A simple fix would be to change the function signature such that nlines is an explicit argument initialized to INF and not passing in n as the first varargin element.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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 group members can vote.

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2015-05-24 philipnienhuis StatusIn Progress Fixed
    Open/ClosedOpen Closed
2015-05-19 philipnienhuis Release3.8.2 dev
2015-05-19 philipnienhuis StatusNone In Progress
2015-05-18 philipnienhuis Assigned toNone philipnienhuis

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code