Borrar filtros
Borrar filtros

hello.can any one tell me how can I find 5 lowest values in a vector without replacement?

1 visualización (últimos 30 días)
for example: A=[3 4 5 1 2 7 3 9 0 1 4 5 7 3 0 8]; and the answer is:B=[1 2 0 1 0];

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 30 de Jul. de 2016
Editada: Azzi Abdelmalek el 30 de Jul. de 2016
A=[3 4 5 1 2 7 3 9 0 1 4 5 7 3 0 8]
[ii,jj]=sort(A)
idx=sort(jj(1:5))
out=A(idx)

Categorías

Más información sobre Startup and Shutdown 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