copy contents of file with variable number in Matlab
input : transient.case
output: transient_1.case, transient_2.case, transient_3.case ...
************transient.case
FORMAT
type: ensight gold
GEOMETRY
model: solution.pval.unsteady_1.geo
VARIABLE
scalar per node: density solution.pval.unsteady_*.density
vector per node: v solution.pval.unsteady_*.v
scalar per node: pressure solution.pval.unsteady_*.pressure
scalar per node: temperature solution.pval.unsteady_*.temperature
TIME
time set: 1
number of steps: 1
filename start number:2
filename increment: 1
time values: 1.0319174484984 1.8385297551528
*******************
where, filename start number:2,
is the same as filename
**************************code.m
n=10;
fileinfo = importdata('transient.case',';');
for i=1:n
filename=sprintf('transient_%d.case',i);
a=cell2mat(fileinfo(13));
idx=find(a==':');
fileinfo(13)=cellstr(strrep(a,a(idx+1:end),num2str(i)));
filePh = fopen(filename,'w');
fprintf(filePh,'%s\n',fileinfo{:});
fclose(filePh);
end
*****************
copy contents of file with variable number in Matlab的更多相关文章
- How to create functions that can accept variable number of parameters such as Format
http://www.chami.com/tips/delphi/112696D.html Sometimes it's necessary to pass undefined number of [ ...
- Variable number of arguments (Varargs)
A parameter of a function (normally the last one) may be marked with vararg modifier: fun <T> ...
- Solved Unable to copy the source file ./installer/services.sh to the destination file /etc/vmware-t
Sometimes when you intall vmwaretools there will be some problems such as "Unable to copy the s ...
- ORA-19502: write error on file "xxxxx", block number xxxx
错误现象: 在ORACLE 10g下为表空间IGNITE_EGVSQL01增加数据文件时,报如下错误: SQL> ALTER TABLESPACE IGNITE_EGVSQL01 AD ...
- MySQL_ERROR 1231 (42000) at line XX in file 'file_name' Variable 'time_zone' can't be
类似的错误信息如下 ERROR 1231 (42000) at line 10370 in file: '/root/sql/ultrax_170322.dmp': Variable 'time_zo ...
- Lua 变长参数(variable number of arguments)
lua变长参数 function add ( ... ) for i, v in ipairs{...} do print(i, ' ', v) end end add(1, 2, 'sdf') lu ...
- [翻译] Macros with a Variable Number of Arguments - GCC
可变参数宏(Variadic Macro) 在1999年的ISO C标准中,可以声明一个像函数一样接受可变参数的宏.定义这种宏的语法与函数的定义相似.这是一个例子: #define debug(for ...
- EmWebAdmin 生成流程分析
继上一篇的简略的说明 EmWebAdmin 的地址以后下载,生成之后,这一篇讲一下该模板的生成流程 // 上一篇地址: http://www.cnblogs.com/chenfulin5/p/6856 ...
- Visual Studio - File Properties (Build Action, Copy to Output Directory)
Ref: MSDN (https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/0c6xyb ...
随机推荐
- Codeforces Round #272 (Div. 2) Dreamoon and WiFi 暴力
B. Dreamoon and WiFi Dreamoon is standing at the position 0 on a number line. Drazil is sending a li ...
- 在Sql Server触发器中判断操作是Insert还是Update还是Delete
在Sql Server触发器中判断操作是Insert还是Update还是Delete DECLARE @IsInsert bit, @IsUpdate bit, @IsDelete ...
- 【BZOJ 2457】 双端队列
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2457 [算法] 贪心 [代码] #include<bits/stdc++.h& ...
- 使用display:flex;实现垂直水平居中
body,div{margin:0px;padding:0px;} .flex-container{display:flex;height:300px;background-color:#ddd;ju ...
- [Swift通天遁地]九、拔剑吧-(17)创建一个三维折叠样式的页面展开效果
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- Appium + python -yaml配置文件
在线安装:pip install yaml import yamlimport os # 获取当前脚本所在文件夹路径curpath = os.path.dirname(os.path.realpath ...
- Android数据存储的5种方法
--使用SharedPreferences存储数据 --文件存储数据 --SQLite数据库存储数据 --使用ContentProvider存储数据 --网络存储数据 Preference,File, ...
- 题解报告:hdu 1863 畅通工程
Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可).经过调查评估,得到的统计表中列出了有可 ...
- Android常用的Dialog对话框用法
Android的版本有很多通常开发的时候对话框大多数使用自定义或是 Google提供的V4, V7 兼容包来开发保持各个版本的对话框样式统一,所以这里使用的是V7 包里的AlertDialog. im ...
- UVM基础之--------uvm_root
uvm_root 是uvm的顶层实例扮演了一个top-level and phase controller 的作用,对于component来说.该类不需要用户实例化,他是一个自动实例化了的类,用户直接 ...