help-octave
[Top][All Lists]
Advanced

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

Re: error with sort function in octave


From: mpender
Subject: Re: error with sort function in octave
Date: Sun, 9 Feb 2014 20:37:24 -0800 (PST)

585venkat wrote
> Hi all,
> 
>   'sort' function in octave is giving me error in the following case.
> 
> [a,b]=sort([1,3,6,4,5])
> a =
> 
>    1   3   4   5   6
> 
> b =
> 
>    1   2   4   5   3
> 
> 
> In the above example 'b' should give ranking of the original values
> passed(i.e 1,2 5,3 4), but it is not giving.  Any explanation for this ??
> 
> Thanks and Regards,
> venki

[1,3,6,4,5] element 1 -> 1
[1,3,6,4,5] element 2 -> 3
[1,3,6,4,5] element 4 -> 4
[1,3,6,4,5] element 5 -> 5
[1,3,6,4,5] element 3 -> 6

sorted list -> [1, 3, 4, 5, 6]; index positions of members in original list
-> [1, 2, 4, 5, 3].

Looks right to me.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/error-with-sort-function-in-octave-tp4661756p4661778.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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