maximum number and indexing
Show older comments
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
Answers (1)
madhan ravi
on 3 Apr 2019
maxk(a,2)
7 Comments
asad jaffar
on 3 Apr 2019
madhan ravi
on 3 Apr 2019
Edited: madhan ravi
on 3 Apr 2019
[Values,Indices] = sort(a,'descend')
[Values(1:2);Indices(1:2)]
asad jaffar
on 3 Apr 2019
madhan ravi
on 3 Apr 2019
I have answered the question you originally asked.
asad jaffar
on 3 Apr 2019
Walter Roberson
on 3 Apr 2019
You should create a different Question for this.
Jan
on 5 Apr 2019
@asad: If madhan's answer solves your problem, be so kind to accept it.
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!