maximum number and indexing
Mostra commenti meno recenti
how can i find maximun number from an array for example .a=[2,44,6,77,3,9],how can i find max 2 numbers which are ,44 and 77 from a single command ? and how to know there index .thanks
Risposte (1)
madhan ravi
il 3 Apr 2019
maxk(a,2)
7 Commenti
asad jaffar
il 3 Apr 2019
madhan ravi
il 3 Apr 2019
Modificato: madhan ravi
il 3 Apr 2019
[Values,Indices] = sort(a,'descend')
[Values(1:2);Indices(1:2)]
asad jaffar
il 3 Apr 2019
madhan ravi
il 3 Apr 2019
I have answered the question you originally asked.
asad jaffar
il 3 Apr 2019
Walter Roberson
il 3 Apr 2019
You should create a different Question for this.
Jan
il 5 Apr 2019
@asad: If madhan's answer solves your problem, be so kind to accept it.
Categorie
Scopri di più su Matrix Indexing 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!