Mercurial > octave
changeset 21676:1d66aa16e338
maint: Periodic merge of stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 04 May 2016 14:14:35 -0700 |
parents | 5e083d07ba35 (current diff) e47eb34f1b05 (diff) |
children | 1cd04fb745f6 |
files | scripts/general/sortrows.m |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/sortrows.m Tue May 03 15:19:47 2016 -0700 +++ b/scripts/general/sortrows.m Wed May 04 14:14:35 2016 -0700 @@ -23,9 +23,25 @@ ## Sort the rows of the matrix @var{A} according to the order of the columns ## specified in @var{c}. ## -## If @var{c} is omitted, a lexicographical sort is used. By default ascending -## order is used however if elements of @var{c} are negative then the -## corresponding column is sorted in descending order. +## By default (@var{c} omitted, or a particular column unspecified in @var{c}) +## an ascending sort order is used. However, if elements of @var{c} are +## negative then the corresponding column is sorted in descending order. If +## the elements of @var{A} are strings then a lexicographical sort is used. +## +## Example: sort by column 2 in descending order, then 3 in ascending order +## +## @example +## @group +## x = [ 7, 1, 4; +## 8, 3, 5; +## 9, 3, 6 ]; +## sortrows (x, [-2, 3]) +## @result{} 8 3 5 +## 9 3 6 +## 7 1 4 +## @end group +## @end example +## ## @seealso{sort} ## @end deftypefn