Saving matlab results many times using loop
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I am having this problem: I need to input different set of data to my code and save results once for a run for 400 times. The problem is I need to save mat file 400 times with 400 different name, anyone here knows how to do it? I am sure it is pretty simple thing, but I have not been able to do so. I would greatly appreciate your response. I want to reiterate again: problem is to save matlab results 400 times with 400 different names (maybe using idices, but I do not know how to do it) using a loop.
Thank you!
回答(1 个)
Kevin Phung
2019-2-5
编辑:Kevin Phung
2019-2-5
just do:
my_filenames = {'file1','file2','file3'}
for i = 1:length(my_filenames)
save(my_filenames{i},'someVariable')
end
edit:
you can programmatically create 400 file names, for example:
my_filenames=cell(1,400)
for i = 1:400
cell{i} = ['file' num2str(i)] %file1, file2, file3, etc
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!