我试图通过我的 Fortran 代码中的 write 命令定义变量名以生成不同的文件,我正在使用这些命令:
character plotname*100,zbin_str*5
open(4,file='luminosity_func.asc')
do j=1,b
mag(j)=mag_min+(j-1)*bin
magup(j)=mag(j)+bin
kk=0
loopread: do jj=1,total
if (z(i).le.redshift(jj).and.redshift(jj).le.zup(i).and.mag(j).le.mag_i(jj).and.mag_i(jj).le.magup(j)) then
vmax=S*dix
fi=fi+1/vmax
kk=kk+1
end if
end do loopread
write(4,'(i5,2x,f20.8,2x,3f9.4,2x,2f7.4,2x,2f14.10)')kk,fi,mag_average,mag(j),magup(j),z(i),zup(i)
end do loopmag
close(4)
zbin=zmin+(i-1)*step+step/2.
open(4,file='luminosity_func.asc')
open(unit=5,file='plot.sm')
write(unit=zbin_str,fmt='(f5.2)') zbin
plotname="LF_z_"//zbin_str//".ps"
write(5,"dev postencap "//plotname)
write(5,'("data luminosity_func.asc")')
write(5,'("read {fi 2 mag 3 }")')
write(5,'("define TeX_strings 1")')
write(5,'("set lfi = lg(fi)")')
write(5,'("ctype blue")')
write(5,'("vecminmax mag magmin magmax")')
write(5,'("XLABEL mag")')
write(5,'("YLABEL log\Phi(m)")')
write(5,"toplabel LF for"//zbin_str)
write(5,'("ptype 12 3 points mag lfi")')
write(5,'("hardcopy")')
close(5)
call system ("sm < plot.sm")
但是当我运行代码时,我收到了这个错误:
forrtl: info (58): format syntax error at or near dev postencap LF_z_ 0.05.ps
forrtl: severe (62): syntax error in format, unit 5, file /home/TES/plot.sm
Image PC Routine Line Source
test 00000000004854BE Unknown Unknown Unknown
test 0000000000483F56 Unknown Unknown Unknown
test 000000000043DE42 Unknown Unknown Unknown
test 000000000040E82B Unknown Unknown Unknown
test 000000000040DD92 Unknown Unknown Unknown
test 0000000000431CBB Unknown Unknown Unknown
test 000000000040455B Unknown Unknown Unknown
test 0000000000402E6C Unknown Unknown Unknown
libc.so.6 00000032F401ECDD Unknown Unknown Unknown
test 0000000000402D69 Unknown Unknown Unknown
我怎么解决这个问题 ?