Try to store data in 2 for loops
1 次查看(过去 30 天)
显示 更早的评论
I've got 2 for loops. The first for loop is for 5 subjects. The second for loop is for 4 measurements. I want to store a figure for subject1, trial1; subject1, trial2; subject1, trial3,...subject5, trial 4.
for welke_pp=1:aantal_pp %for loop for 5 subjects
...
for i_testen=1:length(data_stair_rise)-1 %for loop for 4 measurements
...
folder = 'Data_examen'
pngFileName = sprintf('plot_subject1_trial%d.png', i_testen);
fullFileName = fullfile(folder, pngFileName);
saveas(gcf,fullFileName);
As you can see, at the end op 'pngFileName' I typed only 'i_testen'. So Matlab only stores the figures for trial1,2,3 and 4. But now I want to store the trials for each subject. How do I do this?
0 个评论
采纳的回答
Geoff Hayes
2014-12-23
Sam - use the subject number in our output image name. Something like
pngFileName = sprintf('plot_subject%d_trial%d.png', welke_pp, i_testen);
Now, 20 files should be created, four for each subject.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!