Rank: 8499 based on 3 downloads (last 30 days) and 1 file submitted
photo

Adam McNeilly

E-mail

Personal Profile:

 

Watch this Author's files

 

Files Posted by Adam McNeilly
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 Apr 2013 absmax Returns the value of the element with the largest absolute value in the input matrix. Author: Adam McNeilly absolute, abs, maximum, max, recursion 3 3
Comments and Ratings by Adam McNeilly
Updated File Comments Rating
19 Aug 2013 absmax Returns the value of the element with the largest absolute value in the input matrix. Author: Adam McNeilly

Jan Simon's solution is more efficient.

W. Owen Brimijoin's solution returns a matrix when there is more than one max value.

Comments and Ratings on Adam McNeilly's Files View all
Updated File Comment by Comments Rating
19 Aug 2013 absmax Returns the value of the element with the largest absolute value in the input matrix. Author: Adam McNeilly Adam McNeilly

Jan Simon's solution is more efficient.

W. Owen Brimijoin's solution returns a matrix when there is more than one max value.

05 Apr 2013 absmax Returns the value of the element with the largest absolute value in the input matrix. Author: Adam McNeilly Jan Simon

Even more efficient than W.Owen Brimijoin's suggestion:

[dummy, index] = max(abs(A(:));
result = A(index);

Linear indexing beats the logical indexing here.

05 Apr 2013 absmax Returns the value of the element with the largest absolute value in the input matrix. Author: Adam McNeilly W. Owen Brimijoin

What about this alternate (and arguably simpler) means of solving the problem:

A(abs(A)==max(abs(A(:))))

Hooray for logical indexing!

Contact us