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

 
 

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

Submitter:  -Deleted Account- <gbhrt>
Submitted:  Wed 03 Aug 2011 06:03:19 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  4 Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.2 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2011-08-11 bpabbott StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2011-08-11 gbhrt Attached File- Added str2num.m, #23781
    2011-08-10 bpabbott StatusConfirmed Ready For Test
    2011-08-03 rik5 Priority5 - Normal 4
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code