bugGNU Octave - Bugs: bug #44750, Incorrect output in...

 
 

bug #44750: Incorrect output in textscan/strread with trailing delimiter

Submitter:  Guillaume <gyom>
Submitted:  Mon 06 Apr 2015 06:23:01 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 06 Apr 2015 09:33:25 PM UTC, comment #3: 

Works fine now, thanks Philip!

Guillaume <gyom>
Mon 06 Apr 2015 09:10:55 PM UTC, comment #2: 

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

MultipleDelimsAsOne code has never seen much testing and comparison with Matlab. After a bit of debugging I've just added a condition to the if stmt you indicated. All existing tests passed.

Philip Nienhuis <philipnienhuis>
Group Member
Mon 06 Apr 2015 08:21:06 PM UTC, comment #1: 

Confirmed.

I'll have a look.

strread.m seems to behave properly w/o multipledelimsasone:

>> strread ('/home/foo/', '%s', 'delimiter', '/')
ans =
{
  [1,1] =
  [2,1] = home
  [3,1] = foo
}


but with it:

>> strread ('/home/foo/', '%s', 'delimiter', '/', 'MultipleDelimsAsOne', 1)
ans =
{
  [1,1] = home
}


OS -> Any

Philip Nienhuis <philipnienhuis>
Group Member
Mon 06 Apr 2015 06:23:01 PM UTC, original submission:  


textscan('/home/foo/','%s','delimiter','/','MultipleDelimsAsOne',1)


This command returns {'home'} instead of {'home','foo'}. The correct output is returned when the trailing delimiter is removed: '/home/foo'.

I could track down the problem in strread>split_by:


## In case of trailing delimiter, strip stray last empty word
  if (! isempty (out) && any (sep == text(end)))
    out(end) = [];
  endif


but I am not sure of what the right fix would be without breaking other situations.

Guillaume <gyom>

 

(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

 

Carbon-Copy List
  • -email is unavailable- added by gyom (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 group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-06 philipnienhuis StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-04-06 philipnienhuis StatusNone Confirmed
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code