bugGNU Octave - Bugs: bug #49659, Non-empty ouput for non-matching...

 
 

bug #49659: Non-empty ouput for non-matching regexp with 'names' option

Submitted by:  Guillaume <gyom>
Submitted on:  Mon 21 Nov 2016 12:38:16 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
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 09 Jan 2017 05:06:17 PM UTC, comment #3:

I checked in a fix here (http://hg.savannah.gnu.org/hgweb/octave/rev/cb09392b5b1c). I also added an announcement to the NEWS file since some coders may be relying on the existing format.

Rik <rik5>
Project Administrator
Mon 21 Nov 2016 05:50:34 PM UTC, comment #2:

Interesting. This feature was probably implemented without a lot of checking for Matlab compatibility. It should be relatively easy to return a struct array, rather than a scalar structure.

The file to modify is regexp.cc in libinterp/corefcn.

There are two functions, octregexp and octcellregexp, which probably need modification. The relevant code for octregexp is shown below.

As you can see, in the case of multiple return arguments, it creates a temporary cell and stuffs the results into that cell array, and then assigns to the structure, under the ptn name, the temporary cell array.

Rik <rik5>
Project Administrator
Mon 21 Nov 2016 12:53:19 PM UTC, comment #1:

The output also differs if there is more than one match as the output should be a structure array but Octave creates a structure with cell arrays in fields:

while Matlab does:

Guillaume <gyom>
Mon 21 Nov 2016 12:38:16 PM UTC, original submission:

Octave's output differs from Matlab's when using the 'names' flag and nothing matches.

Octave:

and Matlab:

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 rik5 (Posted a comment)
  • -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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-09 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.4