4
$\begingroup$

Can someone help me to get the maximum element of $m\times n$ matrix and corresponding row and column $(i,j)$?

$\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$
    – Szabolcs
    Apr 2, 2015 at 1:32

1 Answer 1

2
$\begingroup$

Try Max[mat] and Position[mat, Max[mat]].

$\endgroup$
3
  • $\begingroup$ I used mat variable as MatrixForm, so the Position function did not work, e.g., Max /@ mat; Position[mat, Max /@ mat]. Thanks @ Szabolcs. $\endgroup$
    – Frey
    Apr 2, 2015 at 2:34
  • $\begingroup$ @Frey See point 6. here $\endgroup$
    – Szabolcs
    Apr 2, 2015 at 2:38
  • $\begingroup$ Yes, those tips help. I use Table form and it works well :) $\endgroup$
    – Frey
    Apr 2, 2015 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.