我想创建多个表,我想逐个写入文件单元222:
implicit none ....
integer:: i, j, k
.......
double precision, dimension(10, 15) :: callpremiumtable2 = 0.0
open (222, file = "currency_options_simpson_days.dat")
do k = 0, 50, 10
write (222, '(Xa, i3)') "days ahead: ", k
do i = 1, 15
do j = 1, 10
callpremiumtable2(j, i) = callpremium(s - 0.11 + dble(j) / 100.0, x, t - dble(k) / 360.0, r, rf, sd - 0.08 + dble(i) / 100.0)
end do
end do
write (222, '(10F16.8)') callpremiumtable2
write (222, *)
end do
close (222)
contains
double precision function callpremium (...)
函数callpremium运行正常,如果我注释掉内循环,外部也可以工作。
Gfortran抱怨道:
callpremiumtable2(j, i) = callpremium(s - 0.11 + dble(j) / 100.0, x, t - dble(k) / 360.0, r, rf, sd - 0.08 + dble(i) / 100.0
1
Error: Syntax error in CALL statement at (1)
我做错了什么?非常感谢任何指示。