load files within a for loop
Show older comments
Hi!
so, I run my code several times with differents values for some of the parameters, and I saved those results on a .mat files on a folder. What I want to do is to load that files within a for loop so I can plot them one by one. First I create a list of those files I want to plot in the workspace called "bea" and then I tried to load them in the for loop, but is not posible because matlab dosn't recognize "bea" as a file name:
cd 'C:\Users\David\Documents\Tesis\matlab\resultados\saves' %folder where are the files I want to load
folder= dir ('*.mat')
bea={folder.name} %this give a list of the files names I want to load
for id=1:16
load (bea.mat(id)) % in here, I tried to load those files one by one
for ix= 1:rep
hold on
scatter (vec, x_mean(ix, :, 1),'b','filled')
scatter (vec, x_mean(ix, :, 2),'r', 'filled')
end
plot (vec, rep_prom1,'b')
plot (vec, rep_prom2, 'r')
set (gca, 'Xtick', vec, 'Xticklabel', vec)
[ax1,h1]=suplabel('Delta m2');
[ax2,h2]=suplabel('Densidad Poblacional','y');
[ax3,h3]=suplabel(strcat('Densidad poblacional. ', ' Alpha=' ,num2str(alpha), '. p=', num2str(p), '. Respuesta Sigmoide (s=' , num2str(2), ')') ,'t');
set(h3,'FontSize',18)
set(h1,'FontSize',14)
set(h2,'FontSize',14)
print('Densidades Promedio', '-dpng')
end
Any Idea About how to do it? is it possible to load files in a for loop? thanks
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!