how to select the top 5 five values in a matrix

24 Ansichten (letzte 30 Tage)
jaah navi
jaah navi am 28 Mär. 2019
Bearbeitet: madhan ravi am 28 Mär. 2019
If A=rand(5,15) whch generates 5 rows with 15 columns
Could anyone help me how to select the highest 5 values in A.

Akzeptierte Antwort

madhan ravi
madhan ravi am 28 Mär. 2019
Bearbeitet: madhan ravi am 28 Mär. 2019
maxk(A(:),5) % gives the max 5 values of entire matrix
%or
max(A,[],2) % gives max of each row (finally resulting with 5 values)
  2 Kommentare
jaah navi
jaah navi am 28 Mär. 2019
ok.
with respect to command max(A,[],2) it gives one maximum value for each row,could you please help me to find 5 maximum values for each row.
madhan ravi
madhan ravi am 28 Mär. 2019
Bearbeitet: madhan ravi am 28 Mär. 2019
Your question is answered here.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Holidays / Seasons finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by