bugGNU Octave - Bugs: bug #42523, sortrows/sort: only cell arrays of...

 
 

bug #42523: sortrows/sort: only cell arrays of character strings may be sorted error

Submitted by:  None
Submitted on:  Sun 08 Jun 2014 01:41:31 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: Rick TOriginator Email: -unavailable-
Open/Closed: OpenRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 31 Mar 2017 02:21:55 PM UTC, comment #4:

Attached is a small patch allowing the input to be a cell array.

(file #40222)

Guillaume <gyom>
Thu 15 Dec 2016 04:29:51 PM UTC, comment #3:

This issue is still present in Octave 4.2.0.

The code line from comment #1 still throws an error.

Hartmut <hardy>
Sun 31 May 2015 05:42:26 PM UTC, comment #2:

Confirmed still present on the default branch. This error comes from the octave_cell class, where the sort methods are only implemented for cell arrays consisting entirely of strings.

Mike Miller <mtmiller>
Project Administrator
Sun 08 Jun 2014 05:42:41 PM UTC, comment #1:

The root cause looks to be with the built-in function, sort().

Ben Abbott <bpabbott>
Project Member
Sun 08 Jun 2014 01:41:31 PM UTC, original submission:

Sortrows seems to be working differently in matlab then in octave.

http://stackoverflow.com/questions/24099275/what-type-of-array-should-i-use-to-combine-numerical-values-and-string-values-an/24099387?noredirect=1#comment37183633_24099387

Here's the code that should work but it seems to come back with an error

"error: sortrows: only cell arrays of character strings may be sorted
error: called from:
error: /usr/share/octave/3.8.1/m/general/sortrows.m at line 62, column 7"

Here's an example

>> myCell = {1, 2, 'filename1';

3, 4, 'filename2';
5, 6, 'filename3'};

>> array = flipud(sortrows(myCell, 1)) %// "1" => col. "flipud" => descending

ans =
[5] [6] 'filename3'
[3] [4] 'filename2'
[1] [2] 'filename1'

>> array(1,1)

ans =
[5]

>> array(3,3)

ans =
'filename1'

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #40222:  sr.diff added by gyom (975B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 31 Mar 2017 02:21:55 PM UTCgyomAttached File-=>Added sr.diff, #40222
    Sun 31 May 2015 05:42:26 PM UTCmtmillerRelease3.8.1=>dev
    Sun 08 Jun 2014 05:42:41 PM UTCbpabbottCategoryOctave Function=>Libraries
      StatusNone=>Confirmed
      Operating SystemGNU/Linux=>Any
      Summarysortrows: only cell arrays of character strings may be sorted error=>sortrows/sort: only cell arrays of character strings may be sorted error

    Back to the top


    Powered by Savane 3.1-cleanup1