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

 
 

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

Submitted by:  Guillaume <gyom>
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

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>
Project 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>
Project 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)
  •  

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

    Only project 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.5