[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cell arrays of strings in "sort" and "unique"
From: |
David Bateman |
Subject: |
Re: Cell arrays of strings in "sort" and "unique" |
Date: |
Wed, 15 Sep 2004 18:47:12 +0200 |
User-agent: |
Mutt/1.4.1i |
According to Quentin Spencer <address@hidden> (on 09/15/04):
>
> 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
Now this isn't what I would have expected. I'd assumed that the NaN's
were always sorted to the end. It seems that matlab always does an
ascending sort and then a flip(lr|ud) or whatever... It might in fact
be faster this way, but the advantage of always sorting the NaN's
to the end would be that it is easier to drop them...
For compatiability we shoudl probably do the same thing...
Thanks
D.
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
Re: Cell arrays of strings in "sort" and "unique", David Bateman, 2004/09/15