Find the maximum number and its location in the matrix
Mostra commenti meno recenti
Hi,
Right now I have this matrix K
K =
-3 -8 6 -3 -8 6 9 24 -18
-5 10 -9 -5 10 -9 15 -30 27
8 4 9 8 4 9 -24 -12 -27
-9 -24 18 12 32 -24 3 8 -6
-15 30 -27 20 -40 36 5 -10 9
24 12 27 -32 -16 -36 -8 -4 -9
9 24 -18 -15 -40 30 0 0 0
15 -30 27 -25 50 -45 0 0 0
-24 -12 -27 40 20 45 0 0 0
I wonder how I can use any method to find the maximum number and its location from this matrix.
It would be great if anyone can help me with this
Thank you very much :)
1 Commento
Image Analyst
il 7 Dic 2013
Is this homework? If so, tag it as homework.
Risposta accettata
Più risposte (2)
Andrei Bobrov
il 7 Dic 2013
Modificato: Andrei Bobrov
il 7 Dic 2013
[val,idx] = max(K(:));
[ir,ic] = ind2sub(size(K),idx);
Cb
il 29 Apr 2015
0 voti
Im after a similar function in a project I'm working on but i can't seem to get this to work..
Categorie
Scopri di più su Resizing and Reshaping Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!