bugGNU Octave - Bugs: bug #34303, strfind does not work with ascii...

 
 

bug #34303: strfind does not work with ascii the same way as matlab do

Submitted by:  Mikael <mandolin>
Submitted on:  Fri 16 Sep 2011 02:20:43 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.4.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 19 Sep 2011 03:35:58 AM UTC, comment #2:

I agree with Philip. This issue has come up before (See extensive discussion in bug #33537). The conclusion was that Octave would not implement undocumented Matlab features, particularly where there was a good chance of programmer error (You thought you were feeding character data to strfind but in fact the code was giving a numeric result). If you have examined the code carefully and determined that it should be returning numeric values then you can easily override the error by using char() as Philip suggests.

Rik <rik5>
Project Administrator
Sat 17 Sep 2011 10:47:51 AM UTC, comment #1:

As you can see yourself on ML's on-line docs, ML's strfind() formally expects character or cellstring arguments. IOW, what you suggest is that Octave should mimic undocumented ML features.
Using such undocumented features is always risky, as ML might change those w/o notice.

In your example, you can easily do
posA = strfind (char (st), 'A')
to get the same results:

Philip Nienhuis <philipnienhuis>
Project Member
Fri 16 Sep 2011 02:20:43 PM UTC, original submission:

MatLabs version of strfind is able to compare strings when they are in "ascii form" (class double) octave only returns an error.

example

Matlab answer

posA =
9

octave

error: strfind: first argument must be a string or cell array of strings

Mikael <mandolin>

 

(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 philipnienhuis (Posted a comment)
  • -unavailable- added by mandolin (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 19 Sep 2011 03:36:12 AM UTCrik5Open/ClosedOpen=>Closed
    Mon 19 Sep 2011 03:35:58 AM UTCrik5StatusNone=>Wont Fix

    Back to the top


    Powered by Savane 3.1-cleanup1