
Re: second largest element in a matrix
Posted:
Sep 21, 2008 5:39 AM


On Sep 19, 12:47 am, "Steven Lord" <sl...@mathworks.com> wrote: > "Oluwa KuIse" <wespeakfo...@yahoo.com> wrote in message > > news:gav3p9$som$1@fred.mathworks.com... > > > Hello, > > Can anyone pls tell me how I can find the second (or third) largest > > element in a matrix AND its position. The max function gives the largest > > element and its position but how do I find the second largest element and > > its position? > > Call SORT with two output arguments.
You could also use sort on A(:).
Hope this helps.
Greg

