首页 > 解决方案 > 调试旧 Fortran 代码“尝试将 CHARACTER(1) 转换为 INTEGER(4)”

问题描述

我正在使用旧的 Fortran 代码来生成一个使用 NRLMSISE-00 模型用于本科研究项目的大气阻力模型。我没有使用 Fortran 的经验,所以我在 MATLAB 中使用了一个代码,它将针对各种不同的输入情况运行 Fortran 可执行文件。但是,在尝试创建可执行文件时,我遇到了几个错误,如下图所示,旁边是错误的代码段。我意识到我可能需要在错误的代码行中重新定义一些参数或方程,但我不确定如何去做。

我正在尝试在 64 位 Windows 10 系统上的 Cygwin 上使用 gfortran 构建可执行文件。任何和所有的帮助将不胜感激。谢谢!

错误图像

如果图像在此处不起作用,则来自 Cygwin 的错误消息:

Charles@DESKTOP-0CKR2M1 ~
$ gfortran -std=legacy -o nrlmsise00matlabtoformain04 nrlmsise00matlabtoformain04.for nrlmsise00_sub_mlp.for
nrlmsise00_sub_mlp.for:1671:10:

   DATA NAME/'MSIS','E-00'/
      1
Error: Incompatible types in DATA statement at (1); attempted conversion of CHARACTER(1) to INTEGER(4)
nrlmsise00_sub_mlp.for:1670:40:

   DATA ISDATE/'01-F','EB-0','2   '/,ISTIME/'15:4','9:27'/
                                    1
Error: Incompatible types in DATA statement at (1); attempted conversion of CHARACTER(1) to INTEGER(4)
nrlmsise00_sub_mlp.for:1670:10:

   DATA ISDATE/'01-F','EB-0','2   '/,ISTIME/'15:4','9:27'/
      1
Error: Incompatible types in DATA statement at (1); attempted conversion of CHARACTER(1) to INTEGER(4)
nrlmsise00_sub_mlp.for:592:49:

   V2=VTST7(IYD,SEC,GLAT,GLONG,STL,F107A,F107,AP,2)
                                             1
Warning: Actual argument contains too few elements for dummy argument ‘ap’ (1/7) at (1) [-Wargument-mismatch]

标签: matlabdebuggingfortran

解决方案


推荐阅读