bugGNU Octave - Bugs: bug #34147, hex2dec function doesn't work for...

 
 

bug #34147: hex2dec function doesn't work for cell string inputs

Submitter:  None
Submitted:  Sat 27 Aug 2011 09:51:09 AM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Diego Borro Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.4
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 20 Sep 2011 12:24:50 AM UTC, comment #4: 

New feature added in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/36afcd6fc45f).  You can build from source to see the change or wait until the 3.6 release this fall.

Rik <rik5>
Group administrator
Sat 03 Sep 2011 04:44:20 AM UTC, comment #3: 

I think I have a patch for this that works on the development branch.  Could you run two more tests for me against Matlab?


hex2dec({'1B', '2C' ; '1C', '2D'})
hex2dec(['F'; 'A'])


I'm looking to see whether the cell case also returns a column vector and how it is ordered.

Rik <rik5>
Group administrator
Sat 27 Aug 2011 08:09:56 PM UTC, comment #2: 

Yes, I can verify that the following code works perfectly in Matlab R2010a.


hex2dec({'1B' '2C'})


That's why I sent my question. I wanted to know if Octave had that functionality.

Anyway, many thanks for the quick answer. I will use what you say in Octave.

Anonymous
Sat 27 Aug 2011 01:50:15 PM UTC, comment #1: 

Neither the documentation for Octave nor the documentation for Matlab (http://www.mathworks.com/help/techdoc/ref/hex2dec.html) say that hex2dec() can accept cell array of string inputs.  It does accept char array inputs.  For example,


hex2dec (char ('1B', '1C'))
ans =

   27
   28


Can you verify that Matlab accepts cell arrays of strings with the following code?


hex2dec ({'1B})


Rik <rik5>
Group administrator
Sat 27 Aug 2011 09:51:09 AM UTC, original submission:  

Depending on the argument, hex2dec function doesn't work properly. For example, if we put


hex2dec('1B')


The result is 27 (correct).

But if we use cells for introducing more than one value like in:


hex2dec({'1B' '2C'})


The result is an error:

error: binary operator `==' not implemented for `cell' by `scalar' operations
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   C:\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\strings\strjust.m at line 51, column 5
error:   C:\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\strings\base2dec.m at line 74, column 3
error:   C:\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\strings\hex2dec.m at line 47, column 7



Anonymous

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted 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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-20 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2011-09-03 rik5 StatusNone Need Info
    2011-08-27 rik5 Item GroupSegfault, Bus Error, etc. Feature Request
        Summaryhex2dec function doesn\'t work properly. hex2dec function doesn't work for cell string inputs

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code