Finding [index of] the minimal value in array which satisfies a condition in Fortran
arrays, fortran
Solution
You probably want MINVAL.
If your array is say,
array = (/ 21, 52, 831, 46, 125, 68, 7, 8, 549, 10 /)
And you want to find the minimum value greater than say 65,
variable = minval(array, mask=(array > 65))
which would obviously give 68.
Problem
I am looking for a minimal value in an array which is larger than a certain number. I found this discussion which I don't understand. There is `MINLOC`, but it looks like it does not do as much as I would like on its own, though I didn't parse the arguments passed to it in the given examples. (It is also possible to do this using a loop but it could be clumsy.)