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 FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by gyom (Submitted the item)
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 09 Jan 2017 05:06:17 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1