Try to store data in 2 for loops
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sam
el 23 de Dic. de 2014
Comentada: Sam
el 23 de Dic. de 2014
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 comentarios
Respuesta aceptada
Geoff Hayes
el 23 de Dic. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!