bugGNU Octave - Bugs: bug #60521, Allow Boolean input for strfind()

 
 

bug #60521: Allow Boolean input for strfind()

Submitter:  John Beale <jbeale>
Submitted:  Tue 04 May 2021 02:39:35 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 04 May 2021 03:55:09 PM UTC, comment #1: 

See also this related thread on the discourse forum:
https://octave.discourse.group/t/find-start-index-of-group-of-nonzero-elements-in-vector/1113

Lowering priority of this feature request because this is undocumented behavior and there exist several workarounds.

Markus Mützel <mmuetzel>
Group administrator
Tue 04 May 2021 02:39:35 PM UTC, original submission:  

The Octave 6.2 implementation of strfind() is not compatible with  Matlab R2021a, as described below. Matlab strfind() can work on type logical inputs, which some published solutions rely on, and Octave fails unless it is type char.

https://octave.discourse.group/t/find-start-index-of-group-of-nonzero-elements-in-vector/1113

Code demonstrating the problem of finding start/end indexes of groups of non-zero elements (works in Matlab, but not Octave):

TestVec = [0 0 3 4 5 0 0 1 2 0 7 8 9];
mask = logical(TestVec);
starts = strfind([false, mask], [0 1]);
stops = strfind([mask, false], [1 0]);

John Beale <jbeale>

 

(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 jwe (Updated the item)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by jbeale (Submitted the item)
  • -email is unavailable- added by jbeale
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-04 jwe Item GroupMatlab Compatibility Feature Request
    2021-05-04 mmuetzel Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Release6.2.0 dev
        Operating SystemGNU/Linux Any
        Summarycompatibility of strfind() Allow Boolean input for strfind()
    2021-05-04 jbeale Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code