Can someone help me to get the maximum element of $m\times n$ matrix and corresponding row and column $(i,j)$?
Asked
Active
Viewed 2,688 times
1 Answers
2
Try Max[mat] and Position[mat, Max[mat]].
Szabolcs
- 234,956
- 30
- 623
- 1,263
-
I used
matvariable asMatrixForm, so thePositionfunction did not work, e.g.,Max /@ mat; Position[mat, Max /@ mat]. Thanks @ Szabolcs. – Frey Apr 02 '15 at 02:34 -
-
Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Szabolcs Apr 02 '15 at 01:32