Indices of highest values in a vector when values are repeated
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Hi,
I have used the following code to find the top 50% highest values in vector A:
top = round(0.5*length(A))
c = flipud(unique(sort(A)))
result = c(1:top)
index=find(node_degree>=c(top))
result_at=flipud(sortrows([A(index) index], 1))
The issue that I have is some of the values are equal in A. If I have a situation where e.g.:
A = [ 20; 19; 18; 17; 17; 17; 2; 2; 2; 2]
The current code would return indices [1:5], what I would like it to do is expand its selection to return [1:6], i.e. return indices for all values that are in an equal position.
Many thanks for any assistance,
Rob
Antworten (1)
rob
am 13 Jul. 2017
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!