Try to store data in 2 for loops
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Geoff Hayes
le 23 Déc 2014
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!