Help with minimum of a matrix

Hello! I have a function which generates a matrix M containing elements. Some of them are infinite (- Inf for example). I need to extract the minimum finite value of M, but if I write min(M) I obtain of course - Inf. What command can I use ? Thanks

 Respuesta aceptada

Michael Haderlein
Michael Haderlein el 18 de Sept. de 2014

2 votos

min(M(~isinf(M))

2 comentarios

aurc89
aurc89 el 18 de Sept. de 2014
Thanks
John D'Errico
John D'Errico el 18 de Sept. de 2014
Yep.

Iniciar sesión para comentar.

Más respuestas (1)

Youssef  Khmou
Youssef Khmou el 18 de Sept. de 2014

0 votos

As are you are concerned about the global mean, you truncate the Inf elements and compute the min:
M(isinf(M))=[];
min(M)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 18 de Sept. de 2014

Comentada:

el 18 de Sept. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by