Rank: 6598 based on 16 downloads (last 30 days) and 1 file submitted
photo

Adam McNeilly

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Adam
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 16 3
Comments and Ratings by Adam
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'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 McNeilly, Adam

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 Simon, Jan

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 Brimijoin, W. Owen

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

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

Hooray for logical indexing!

Contact us