bugGNU Octave - Bugs: bug #37551, strcmp produces weird result

 
 

bug #37551: strcmp produces weird result

Submitted by:  None
Submitted on:  Thu 11 Oct 2012 09:57:35 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Works For MeAssigned to: None
Originator Name: CFBOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.1
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 12 Oct 2012 05:47:03 PM UTC, comment #3:

I cannot reproduce either in 3.6.3, so I'm closing this bug.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Fri 12 Oct 2012 05:46:16 PM UTC, comment #2:

I reproduce below what the original reporter sent to me via email:

Example1

actual code:

strcmp('a','a')

expected value: ans=1
returned value: ans=0

strcmpi('a','a') produces the expected value: ans=1

Example2

actual code:
choice='l';
strcmp(choice,{'l' 's' 'z' 'b' 'p' 'i'})

expected value: ans=1 0 0 0 0 0
returned value: error: cell type invalid as index source

strcmp(choice,{'l' 's' 'z' 'b' 'p' 'i'}) produces the expected value: ans=1 0 0 0 0 0

Cheers,

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Thu 11 Oct 2012 10:11:59 PM UTC, comment #1:

I cannot reproduce the first problem. I do not know what is the alleged second problem, because I don't know what the result is and I don't know what the expected result is. The last result is as expected.

Please post an actual working test case (something I can just paste into Octave) that demonstrates the unexpected behaviour and state what behaviour you expected instead.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Thu 11 Oct 2012 09:57:35 PM UTC, original submission:

Strcmp(choice,mainvalid) [where choice='l' and mainvalid={'l' 's' etc}] gives error: cell type invalid as index source.
Trying strcmp('a','a') gives ans=0.

strcmpi(choice,mainvalid) gives the expected vector
strcmpi('a','a') gives ans=1

Am I not understanding strcmp correctly?
-CFB

Anonymous

 

(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 jordigh (Posted a comment)
  • -unavailable- added by None (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 12 Oct 2012 05:47:03 PM UTCjordighStatusNeed Info=>Works For Me
      Open/ClosedOpen=>Closed
    Thu 11 Oct 2012 10:11:59 PM UTCjordighStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1