bugGNU Octave - Bugs: bug #33940, str2num and other conversion...

 
 

bug #33940: str2num and other conversion functions do not return a flag

Submitted by:  -Deleted Account- <gbhrt>
Submitted on:  Wed 03 Aug 2011 06:03:19 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 4Item Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.4.2Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 11 Aug 2011 01:50:14 PM UTC, comment #3:

I had made a similar change to str2num.m. You can see the change at the link below.

http://hg.savannah.gnu.org/hgweb/octave/rev/0c74237b3479

I've built and tested the sources using this change. All looks good to me.

I'll close this item. If necessary it can be reopened.

Thanks

Ben Abbott <bpabbott>
Project Member
Thu 11 Aug 2011 06:15:35 AM UTC, comment #2:

Thank you. I was unable to find the changeset but realised this was easy to fix myself since the funtion was defined in str2num.m

I have modified it to return a flag and attached the modified str2num.m file.

I'm sorry, I just assumed in the first post that the other conversion functions also returns flags but when looking in the matlab docs I see that only str2num does that, so it was only str2num that had the issue.

I did notice however that in octave str2double does return a flag, in matlab it does not.

-Deleted Account- <gbhrt>
Wed 10 Aug 2011 11:17:57 PM UTC, comment #1:

I've pushed a chagneset.

PL, can you tell me which other conversion functions are also missing this flag?

Ben Abbott <bpabbott>
Project Member
Wed 03 Aug 2011 06:03:19 PM UTC, original submission:

In Matlab str2num and most other conversion functions return the value and a flag if the conversion was ok, Octave does not.

Example in Matlab:

>> s = '123';
>> [n, ok] = str2num(s)


n =

123

ok =

1

In Octave this error occurs:

"error: element number 2 undefined in return list"

-Deleted Account- <gbhrt>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #23781:  str2num.m added by gbhrt (2KiB - text/plain - Modified str2num that returns flag if conversion was ok or not (as in matlab))

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bpabbott (Posted a comment)
  • -unavailable- added by rik5 (Updated 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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 11 Aug 2011 01:50:14 PM UTCbpabbottStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Thu 11 Aug 2011 06:10:59 AM UTCgbhrtAttached File-=>Added str2num.m, #23781
    Wed 10 Aug 2011 11:17:57 PM UTCbpabbottStatusConfirmed=>Ready For Test
    Wed 03 Aug 2011 10:42:51 PM UTCrik5Priority5 - Normal=>4
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1