[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cell arrays of strings in "sort" and "unique"
From: |
Quentin Spencer |
Subject: |
Re: Cell arrays of strings in "sort" and "unique" |
Date: |
Wed, 15 Sep 2004 11:24:07 -0500 |
User-agent: |
Mozilla Thunderbird 0.7.3 (X11/20040803) |
David Bateman wrote:
I have a problem in implementing the "descend" flag. Where are the
NaN's sorted? As this was introduced in R14, which I don't have access
to.. So I need some one to run the example
x = [Inf, NaN, -Inf, 3, 2, 1];
[a, ai] = sort (x, "ascend")
[a, ai] = sort (x, "descend")
x = [Inf, NaN, -Inf, 3, 2, 1I];
[a, ai] = sort (x, "ascend")
[a, ai] = sort (x, "descend")
Output from MATLAB R14:
>> x = [Inf, NaN, -Inf, 3, 2, 1];
>> [a, ai] = sort (x, 'ascend')
a =
-Inf 1 2 3 Inf NaN
ai =
3 6 5 4 1 2
>> [a, ai] = sort (x, 'descend')
a =
NaN Inf 3 2 1 -Inf
ai =
2 1 4 5 6 3
/home/qspencer> mat
Warning: Could not query OpenGL.
Warning: OpenGL appears to be installed incorrectly.
< M A T L A B >
Copyright 1984-2004 The MathWorks, Inc.
Version 7.0.0.19901 (R14)
May 06, 2004
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
>> x = [Inf, NaN, -Inf, 3, 2, 1];
>> [a, ai] = sort (x, 'ascend')
a =
-Inf 1 2 3 Inf NaN
ai =
3 6 5 4 1 2
>> [a, ai] = sort (x, 'descend')
a =
NaN Inf 3 2 1 -Inf
ai =
2 1 4 5 6 3
>> x = [Inf, NaN, -Inf, 3, 2, 1i];
>> [a, ai] = sort (x, 'ascend')
a =
Columns 1 through 4
0 + 1.0000i 2.0000 3.0000 Inf
Columns 5 through 6
-Inf NaN
ai =
6 5 4 1 3 2
>> [a, ai] = sort (x, 'descend')
a =
Columns 1 through 4
NaN -Inf Inf 3.0000
Columns 5 through 6
2.0000 0 + 1.0000i
ai =
2 3 1 4 5 6
Re: Cell arrays of strings in "sort" and "unique", David Bateman, 2004/09/15