copy and rename a file multiple times using Matlab


for file.txt
***********
n=10;
fileinfo=importdata('file.txt');
for i=1:n
filename=sprintf('file_%d.txt',i);
filePh = fopen(filename,'w');
fprintf(filePh,'%s\n',fileinfo{:});
fclose(filePh);
end
**********

for transient.case

**********

n=101;
fileinfo=importdata('transient.case',';');
for i=1:n
filename=sprintf('transient_%d.case',i);
filePh = fopen(filename,'w');
fprintf(filePh,'%s\n',fileinfo{:});
fclose(filePh);
end

****************

 

posted @ 2019-02-18 20:26  kaiming_ai  阅读(132)  评论(0编辑  收藏  举报