Help with minimum of a matrix

3 次查看(过去 30 天)
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

采纳的回答

Michael Haderlein
Michael Haderlein 2014-9-18
min(M(~isinf(M))

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by