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

1 次查看(过去 30 天)
code:
A = 1:10;
B = maxk(A,3)
function
function y=maxk(A,3)
A=sort(unique(A,'descend'))
y=A(1:3)
end

回答(1 个)

KSSV
KSSV 2019-3-28
编辑:KSSV 2019-3-28
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 个评论
madhan ravi
madhan ravi 2019-3-28
KSSV the OP asks the same question again and again , why did you reopen the closed question ignoring the comment?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by