views:

43

answers:

1

To generate an ouput file (.rwo format) containing the desired result, we have to run the executable of the report program which uses a parameter file (.rwd format). The output file is ReportBHP1.rwo, this file will contain the variable exported.

Now to implement this in Matlab, below is a small script giving a gist of what I am trying to achieve. It call CMG (software) for each realization and extracts the data.

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

All of my software's required .exe and .dll files are in the same folder where I have my ReservoirModel_CMGBulider.dat file. So I am running the .m file through the same folder where I have all these files.

I am able to generate the output (.rwo) file. However there is an error in the simulation report of the software which is displayed in Matlab's command window as follow:

"...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"

I think its reading the .dat file only one time and then overwriting the first realization result in rest of the realizations. As a consequence of this the result of all the realizations is coming out to be same as the first realization. I need help in correcting this error.

+1  A: 

First, if my previous answer was OK, could you accept it? Thanks!

Second, have you tried using full path names for all the files as before?

Jacob
Hey Jacob. Your previous answer was ofcourse useful. However it couldn't solve the problem. If accepting answer is based on being OK (also) apart from being the solution, then I can surely do that :) . You can see my EDIT 2 for the command which solved the output file issue.
Harpreet
Full path names is not helping. I could generate the output file without that by keeping all the files in one folder. See my EDIT 2 in the link where I have accepted your answer. Thanks.
Harpreet
Thanks Jacob. I tried again and adding the full path for .dat file worked. Sometimes it was strange because even adding the full path was not helping. Now its working. :-)
Harpreet