select neighbors and find Top n in Matlab -
this question has answer here:
if have matrix this:
sample = [1 0.21852382 0.090085552 0.219984954 0.446286385; 0.21852382 1 0.104580323 0.138429617 0.169216538; 0.090085552 0.104580323 1 0.237582739 0.105637177; 0.219984954 0.138429617 0.237582739 1 0.192753169; 0.446286385 0.169216538 0.105637177 0.192753169 1 ]
i want find top 3 max values in every rows in matlab. in matlab? , true? want find top-n method in select neighbors.
i recommend rewording question. want top ten max values in every row, matrix gave has 5 columns :/
i think looking this.
sample = [1 0.21852382 0.090085552 0.219984954 0.446286385; 0.21852382 1 0.104580323 0.138429617 0.169216538; 0.090085552 0.104580323 1 0.237582739 0.105637177; 0.219984954 0.138429617 0.237582739 1 0.192753169; 0.446286385 0.169216538 0.105637177 0.192753169 1 ] b = sort(sample,2,'descend') % sort rows of array in descending order c = b(:,1:n) % select top n values.
hope answers question.
Comments
Post a Comment