bugGNU Octave - Bugs: bug #54432, strmatch incompatibilities with...

 
 

bug #54432: strmatch incompatibilities with Matlab when using empty inputs

Submitted by:  Arnaud Delorme <arnodelorme>
Submitted on:  Thu 02 Aug 2018 04:22:28 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.4.0 Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Wed 08 Aug 2018 06:44:36 PM UTC, comment #6:

I checked in a small additional change to accept an empty cellstr here (https://hg.savannah.gnu.org/hgweb/octave/rev/e4f670d9df5c).

Rik <rik5>
Project Administrator
Fri 03 Aug 2018 06:14:00 PM UTC, comment #5:

The other bit about an empty string always matching is just weird. Trying to deduce the exact ruleset is tedious, and this function is strongly recommended not to be used by Matlab. As such, there's not much incentive to work on it.

If someone wants to amend strmatch, they need to also take in to account results from bug #49601 which are equally bizarre.

Rik <rik5>
Project Administrator
Fri 03 Aug 2018 06:09:32 PM UTC, comment #4:

I changed strmatch to accept a single cellstr as the first input in this cset (https://hg.savannah.gnu.org/hgweb/octave/rev/799dcddaf158).

Rik <rik5>
Project Administrator
Thu 02 Aug 2018 09:16:15 PM UTC, comment #3:

My code has been functional on Matlab since 2000. So pretty much all versions since Matlab 5.3

>> strmatch ('', 'a')


ans =

1

>> strmatch ({'on'}, {'on', 'off'}, 'exact')


ans =

1

Arnaud Delorme <arnodelorme>
Thu 02 Aug 2018 08:40:25 PM UTC, comment #2:

Can you use verbatim tags when posting code samples? It seems that some of the examples may have been truncated.

I also wonder if this has changed. I don't recall strmatch with a null input matching any character. That is more of a regexp kind of behavior. What does this return which doesn't use cell array of strings?

Also, can you try

Rik <rik5>
Project Administrator
Thu 02 Aug 2018 04:39:19 PM UTC, comment #1:

I have found another difference

Matlab 2018a
strmatch({}, {'on' 'off'}, 'exact')
ans =
[]

Octave 4.4.0 (--traditional)
strmatch({}, {'on' 'off'}, 'exact')
error: strmatch: S must be a string

Arnaud Delorme <arnodelorme>
Thu 02 Aug 2018 04:22:28 PM UTC, original submission:

Under Matlab 2018a

strmatch( '', {'a' 'b' 'c' })

ans =

1
2
3

Under Octave 4.4.0

strmatch( '', {'a' 'b' 'c' })

ans = []

Arnaud Delorme <arnodelorme>

 

(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 arnodelorme (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-03 rik5 Priority5 - Normal => 3 - Low
        StatusNeed Info => Confirmed
        Summarystrmatch incompatibilities with Matlab => strmatch incompatibilities with Matlab when using empty inputs
    2018-08-02 rik5 StatusNone => Need Info
        Operating SystemMac OS => Any
        Summarystrmatch => strmatch incompatibilities with Matlab

    Back to the top


    Powered by Savane 3.3