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: Index for max element in a matrix?
Replies: 8   Last Post: May 16, 2012 1:38 PM

Advanced Search

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

Posts: 8,232
Registered: 6/7/07
Re: Index for max element in a matrix?
Posted: Jun 10, 2008 6:57 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

saneman wrote:
> I have this matrix:
>
> A = [15 12 11;
> 20 44 23;
> 33 32 34];
>
>
> Is there a function in matlab that returns the x and y index for the
> maximum/minimum element? In this case the function should return (2,2).
>
> If I use:
>
> find(A==(max(max(A))))
>
> I just get 5.


ind2sub(size(A),5)

--



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.