Saving matlab results many times using loop

2 Ansichten (letzte 30 Tage)
Santosh Sharma
Santosh Sharma am 5 Feb. 2019
Kommentiert: Stephen23 am 6 Feb. 2019
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!

Antworten (1)

Kevin Phung
Kevin Phung am 5 Feb. 2019
Bearbeitet: Kevin Phung am 5 Feb. 2019
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

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by