maximum number and indexing
Ältere Kommentare anzeigen
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
Antworten (1)
madhan ravi
am 3 Apr. 2019
maxk(a,2)
7 Kommentare
asad jaffar
am 3 Apr. 2019
madhan ravi
am 3 Apr. 2019
Bearbeitet: madhan ravi
am 3 Apr. 2019
[Values,Indices] = sort(a,'descend')
[Values(1:2);Indices(1:2)]
asad jaffar
am 3 Apr. 2019
madhan ravi
am 3 Apr. 2019
I have answered the question you originally asked.
asad jaffar
am 3 Apr. 2019
Walter Roberson
am 3 Apr. 2019
You should create a different Question for this.
Jan
am 5 Apr. 2019
@asad: If madhan's answer solves your problem, be so kind to accept it.
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!