data analysis
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
if i have array x and i want to get the index of maximum value of it ex:x=[1 2 3 4 5 0 11] i want command which give me that index of max(x)->7
0 Commenti
Risposta accettata
Geoff
il 19 Mar 2012
Use the find function:
indices = find(x == max(x));
There might be more than one maximum, so your output might be a vector. If you want just one value, use this:
index = find(x == max(x), 1);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su MATLAB Report Generator in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!