Help with minimum of a matrix

1 view (last 30 days)
aurc89
aurc89 on 18 Sep 2014
Commented: John D'Errico on 18 Sep 2014
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

Accepted Answer

Michael Haderlein
Michael Haderlein on 18 Sep 2014
min(M(~isinf(M))

More Answers (1)

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

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!