Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: second largest element in a matrix
Replies: 32   Last Post: May 5, 2013 10:31 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Oluwa KuIse

Posts: 37
Registered: 9/18/08
Re: second largest element in a matrix
Posted: Sep 19, 2008 12:38 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

It worked! Thanks
"Pekka " <pekka.nospam.kumpulainen@tut.please.fi> wrote in message <gavern$shn$1@fred.mathworks.com>...
> "Oluwa KuIse" <wespeakforex@yahoo.com> wrote in message <gavctp$8tv$1@fred.mathworks.com>...
> > "Call SORT with two output arguments."
> > Can you pls give me a quick example of how to do this? Thank you so much, Steve.
> > "Steven Lord" <slord@mathworks.com> wrote in message <gavast$1dd$1@fred.mathworks.com>...

> > >
> > > "Oluwa KuIse" <wespeakforex@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.
> > >
> > > --
> > > Steve Lord
> > > slord@mathworks.com
> > >

>
> Example for m by n matrix:
> m=3;n=4;ggg = rand(m,n);
> [svals,idx] = sort(ggg(:),'descend'); % sort to vector
> svals(2) % second largest value
> [II,JJ] = ind2sub([m,n],idx(2)) % position in the matrix




Date Subject Author
9/18/08
Read second largest element in a matrix
Oluwa KuIse
9/19/08
Read Re: second largest element in a matrix
stephanie
9/19/08
Read Re: second largest element in a matrix
Steven Lord
9/19/08
Read Re: second largest element in a matrix
Oluwa KuIse
9/19/08
Read Re: second largest element in a matrix
Pekka
9/19/08
Read Re: second largest element in a matrix
Oluwa KuIse
9/21/08
Read Re: second largest element in a matrix
Greg Heath
9/24/08
Read Re: second largest element in a matrix
Walter Roberson
3/4/09
Read Re: second largest element in a matrix
Justin
4/6/09
Read Re: second largest element in a matrix
Bruno Luong
4/6/09
Read Re: second largest element in a matrix
Jos
4/6/09
Read Re: second largest element in a matrix
Bruno Luong
4/6/09
Read Re: second largest element in a matrix
Bruno Luong
4/6/09
Read Re: second largest element in a matrix
mike zander
4/7/09
Read Re: second largest element in a matrix
Bruno Luong
4/7/09
Read Re: second largest element in a matrix
Bruno Luong
4/3/09
Read Re: second largest element in a matrix
Paul
11/7/12
Read Re: second largest element in a matrix
sssbi2009@gmail.com
11/19/12
Read Re: second largest element in a matrix
dpb
4/3/09
Read Re: second largest element in a matrix
Paul
4/3/09
Read Re: second largest element in a matrix
mike zander
4/3/09
Read Re: second largest element in a matrix
mike zander
4/3/09
Read Re: second largest element in a matrix
mike zander
4/3/09
Read Re: second largest element in a matrix
Walter Roberson
4/3/09
Read Re: second largest element in a matrix
mike zander
5/4/13
Read Re: second largest element in a matrix
tilindg1@gmail.com
5/4/13
Read Re: second largest element in a matrix
Nasser Abbasi
5/4/13
Read Re: second largest element in a matrix
dpb
5/5/13
Read Re: second largest element in a matrix
Nasser Abbasi
5/5/13
Read Re: second largest element in a matrix
dpb
5/5/13
Read Re: second largest element in a matrix
Bruno Luong
5/5/13
Read Re: second largest element in a matrix
Nasser Abbasi
5/5/13
Read Re: second largest element in a matrix
Bruno Luong

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.