慕运维8079593
我可以为这个问题显示一个很好的解决方案。我也是MATLAB的前用户,切换到FORTRAN时会错过函数句柄哈哈。我以这种方式解决了您的问题:module private public :: f , g real(kind=RP) :: a0,b0,c0,... contains function f(x,a,b,c,d,...) implicit none real(kind=RP) :: x,a,b,c,d,... real(kind=RP) :: f! Here you define your function f = ... end function f function g(x) implicit none real(kind=RP) :: x , g! Here you call "f" function with the frozen variables *0 g = f(x,a0,b0,c0,...) end function g! We said that parameters were private ! (to avoid to be modified from the outside, which can be dangerous, ! so we define functions to set their values subroutine setValues(a,b,c,...) implicit none real(kind=RP) :: a,b,c,... a0 = a b0 = b c0 = c end subroutine setValuesend module