matlab builder for java和保存路径有关吗_如何在Matlab中将通用文件名称作为函数参数包含在路径位置中?...

该博客讨论了如何在Matlab函数中接受用户输入的文件名,如ReservoirModel_CMGBuilder,以便动态调整路径并读取.dat文件。作者寻求解决如何在调用CMG软件时,替换硬编码的文件名,同时处理其他文件如Reportq_rwd和Reportq_rwo。

关于我想要的内容摘要:如果我将文件名作为函数的参数,如何将该文件名包含在路径位置中,使得路径位置中的文件名是一个用户输入的。如果你不明白我在说什么,然后阅读下面的解释:如何在Matlab中将通用文件名称作为函数参数包含在路径位置中?

二次说明:

我提出这要求呼叫被叫CMG软件的通用功能。该软件需要一个.dat文件,其名称作为函数中的参数,其参数中的通用名称为ReservoirModel_CMGBuilder。正如您在下面的部分代码中看到的,这个ReservoirModel_CMGBuilder文件保存在我输入的路径位置的文件夹中。但是,问题在于文件名是用引号引起的,所以它不能识别代码中的文件名。我想要的是从用户那里获取CMG所需的.dat文件名的名称,并将其存储在名称ReservoirModel_CMGBuilder中,然后在路径位置使用该名称来提取该文件。

同样我想为Reportq_rwd和Reportq_rwo做这件事。我怎样才能做到这一点?

function [q_yearly,Swav_yearly]=q_from_CMG_general(nModel,nCell,T,ReservoirModel_CMGBuilder,poro_models_gslib_file,perm_models_gslib_file,Reportq)

ReservoirModel_CMGBuilder=[ReservoirModel_CMGBuilder '.dat']; % string concatenation

Reportq_rwd=[Reportq '.rwd'];

Reportq_rwo=[Reportq '.rwo'];

poro_models=gslib_file_to_matlab_var(nModel,nCell,poro_models_gslib_file);

perm_models=gslib_file_to_matlab_var(nModel,nCell,perm_models_gslib_file);

%% loop to run all nModel

for model_no=1:nModel

%% Writing the porosity and permeability model one at a time in .inc file, which will be read and will work as input to porosity and permeability models in CMG

dlmwrite('poro_model.inc',poro_models(:,model_no),'delimiter','\n');

dlmwrite('perm_model.inc',perm_models(:,model_no),'delimiter','\n');

%% Prior to driling an exploratory well or acquiring a seismic with just 5 producing wells

%# Calls CMG

system('mx200810.exe -f "C:\Documents and Settings\HSingh2\Desktop\Work\Model - SGEMS, CMG and MATLAB\ReservoirModel_CMGBuilder"') % Calls CMG

%# Calls parameter report file and generates output file

system('report.exe /f Reportq_rwd /o Reportq_rwo')

2010-10-06

Pupil

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值