Location of maximum number in matrix??
30 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Maruti Patil
am 20 Apr. 2015
Bearbeitet: Stephen23
am 20 Apr. 2015
%Suppose I have a matrix
A=[2 3 4;
5 6 7;
8 9 0];
%I want to Find the location of maximum number in the matrix ie of 9.
%How to find it??
c=max(A); % what to do next ?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Julia
am 20 Apr. 2015
Hi,
you have to take the "double maximum", since your c gives a vector. Then you can use the find() function.
>> c=max(max(A))
>> B=find(A==c)
B is just a number. To see how Matlab uses linear indexing click the following link:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!