octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #42523] sortrows: only cell arrays of characte


From: anonymous
Subject: [Octave-bug-tracker] [bug #42523] sortrows: only cell arrays of character strings may be sorted error
Date: Sun, 08 Jun 2014 13:41:32 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0

URL:
  <http://savannah.gnu.org/bugs/?42523>

                 Summary: sortrows: only cell arrays of character strings may
be sorted error
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sun 08 Jun 2014 01:41:31 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Rick T
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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'




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42523>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]