Borrar filtros
Borrar filtros

Maximum arrays of a matrix

1 visualización (últimos 30 días)
armin m
armin m el 5 de Dic. de 2021
Comentada: Walter Roberson el 6 de Dic. de 2021
Hi i have a matrix woth 543 arrays. I wanna choose 10 maximum arrays between these 543 arrays. Need help!
  4 comentarios
armin m
armin m el 6 de Dic. de 2021
Editada: armin m el 6 de Dic. de 2021
Yes all the same size and numeric. Matrix may changes in each loop
DGM
DGM el 6 de Dic. de 2021
That's just a numeric vector. You said you have a matrix of arrays.

Iniciar sesión para comentar.

Respuesta aceptada

DGM
DGM el 6 de Dic. de 2021
If all you need to work on is a numeric vector, then
W = [3 5 4 6 7 8 66 444 33 23 4];
Wmx = maxk(W,5) % R2017b or newer
Wmx = 1×5
444 66 33 23 8
Note that maxk() is relatively new. You can also do the same thing using sort()
% any version
Wmx = sort(W,'descend');
Wmx = Wmx(1:5)
Wmx = 1×5
444 66 33 23 8
  9 comentarios
armin m
armin m el 6 de Dic. de 2021
That do my work. But if that can be use for more than 1 ro and column, it is better.thank a lot
Walter Roberson
Walter Roberson el 6 de Dic. de 2021
use ind2sub() to convert the second output into a row and column number.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by