Borrar filtros
Borrar filtros

How can I extract all values in a row of an array without the its maximum value

1 visualización (últimos 30 días)
ex a=
1 3 6 5
6 7 1 9
5 3 9 10
the extracted row will be 5 3 9

Respuesta aceptada

Stephen23
Stephen23 el 19 de Nov. de 2017
Editada: Stephen23 el 19 de Nov. de 2017
>> a = [1,3,6,5;6,7,1,9;5,3,9,10]
a =
1 3 6 5
6 7 1 9
5 3 9 10
>> [r,c] = find(a==max(a(:))); % identify row and column of max value.
>> b = a(r,[1:c-1,c+1:end]) % extract row, excluding max value.
b =
5 3 9

Más respuestas (1)

KL
KL el 19 de Nov. de 2017
A = [5 3 9 10];
res = A(A~=max(A))

Categorías

Más información sobre Multidimensional Arrays 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