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

 
 

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

Submitted by:  None
Submitted on:  Thu 07 May 2015 04:09:37 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Philip Nienhuis <philipnienhuis>
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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 5 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sun 24 May 2015 09:08:33 PM UTCphilipnienhuisStatusIn Progress=>Fixed
  Open/ClosedOpen=>Closed
Tue 19 May 2015 09:58:47 PM UTCphilipnienhuisRelease3.8.2=>dev
Tue 19 May 2015 09:58:30 PM UTCphilipnienhuisStatusNone=>In Progress
Mon 18 May 2015 06:36:04 PM UTCphilipnienhuisAssigned toNone=>philipnienhuis

Back to the top


Powered by Savane 3.1-cleanup1