使用“系统”调用软件时,Matlab无法将.dat文件作为数据文件打开

时间:2010-07-11 22:40:56

标签: matlab

要生成包含所需结果的输出文件(.rwo格式),我们必须运行使用参数文件(.rwd格式)的报告程序的可执行文件。输出文件是ReportBHP1.rwo,该文件将包含导出的变量。

现在要在Matlab中实现这个,下面是一个小脚本,给出了我想要实现的目标。它为每个实现调用CMG(软件)并提取数据。

for nr=1:NREAL

      dlmwrite(‘PERM.INC’,PERM(:,nr),’delimiter’,’\n’); % Writes the permeability file for each realization

      system('mx200810.exe -f ReservoirModel_CMGBulider.dat')  % Calls CMG
      system('report.exe /f ReportBHP1.rwd /o ReportBHP1.rwo') % Calls Parameter file and generates output file

      [TIME(:,j),BHP1(:,j)]=textread('ReportBHP1.rwo','%f\t%f','headerlines',5); % reading the time and BHP from output file generated for well 1

end

我所有的软件所需的.exe.dll文件都在我的ReservoirModel_CMGBulider.dat文件所在的文件夹中。所以我通过我拥有所有这些文件的同一文件夹运行.m文件。

我能够生成输出(.rwo)文件。但是,在Matlab的命令窗口中显示的软件模拟报告中存在错误,如下所示:

"...STOP: Unable to open the following file as data file:
              'ReservoirModel_CMGBuilder.dat'
              Check path name for spaces, special character or a total length greater than 256 characters

              Cannot find data file named 'ReservoirModel_CMGBuilder.dat'

Date and Time of End of Run: .....

ans = 0"

我认为它只读取.dat文件一次,然后在其余的实现中覆盖第一个实现结果。因此,所有实现的结果都与第一个实现相同。我需要帮助来纠正这个错误。

1 个答案:

答案 0 :(得分:1)

首先,如果我之前的回答没问题,你能接受吗?谢谢!

其次,您是否尝试过像以前一样对所有文件使用完整路径名?