The Math Forum



Search All of the Math Forum:

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


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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: use function find to search for multiple values
Replies: 1   Last Post: Nov 18, 2014 4:48 PM

Advanced Search

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

Posts: 21
Registered: 5/20/12
use function find to search for multiple values
Posted: Nov 18, 2014 4:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi there,
I have a matrix A which is 1024x810. For each row, I need to find the maximum value and then locate the position of the maximum value on each row. I am thinking of the following code

A = rand(1024, 810);
find(A==max(A, [], 2))

but this doesn't work. If I use a loop to search one row at a time, it return the position as expected but it is quite slow to use a loop since above operation will be performed so many times. Any idea to do it faster? Thanks



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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.