Can someone help me to get the maximum element of $m\times n$ matrix and corresponding row and column $(i,j)$?
$\begingroup$
$\endgroup$
1
-
$\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$– SzabolcsApr 2, 2015 at 1:32
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
3
Try Max[mat]
and Position[mat, Max[mat]]
.
-
$\begingroup$ I used
mat
variable asMatrixForm
, so thePosition
function did not work, e.g.,Max /@ mat; Position[mat, Max /@ mat]
. Thanks @ Szabolcs. $\endgroup$– FreyApr 2, 2015 at 2:34 -
-
$\begingroup$ Yes, those tips help. I use
Table
form and it works well :) $\endgroup$– FreyApr 2, 2015 at 2:43