Filter löschen
Filter löschen

could anyone help me to overcome the error in following code:

1 Ansicht (letzte 30 Tage)
jaah navi
jaah navi am 28 Mär. 2019
Bearbeitet: KSSV am 28 Mär. 2019
code:
A = 1:10;
B = maxk(A,3)
function
function y=maxk(A,3)
A=sort(unique(A,'descend'))
y=A(1:3)
end

Antworten (1)

KSSV
KSSV am 28 Mär. 2019
Bearbeitet: KSSV am 28 Mär. 2019
Read about unique and sort. The term descend should be for sort.
function y=maxk(A,3)
A=sort(unique(A),'descend')
y=A(1:3)
end
  1 Kommentar
madhan ravi
madhan ravi am 28 Mär. 2019
KSSV the OP asks the same question again and again , why did you reopen the closed question ignoring the comment?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Shifting and Sorting Matrices 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