Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
jaah navi
jaah navi el 28 de Mzo. de 2019
Editada: KSSV el 28 de Mzo. de 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

Respuestas (1)

KSSV
KSSV el 28 de Mzo. de 2019
Editada: KSSV el 28 de Mzo. de 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 comentario
madhan ravi
madhan ravi el 28 de Mzo. de 2019
KSSV the OP asks the same question again and again , why did you reopen the closed question ignoring the comment?

Iniciar sesión para comentar.

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by