How to plot data from mutiple files in a loop so that all is collated in one figure?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I have a list of of 11 files which are structures with a table.
I want to access a variable in each table from each file and collate it in one figure.
My approach below results in plotting only one variable, instead of 11. Can you help please?
for k = 1:length(files)
% Load data
A = fullfile(Folder,files(k).name);
data = load(A);
% Plot selected variable from each file in one figure
figure;
plot(data.Cycles.Cop_x_l_meancycle);
hold on
end
0 commentaires
Réponse acceptée
KSSV
le 21 Juil 2022
data = cell(length(files),1) ;
for k = 1:length(files)
% Load data
A = fullfile(Folder,files(k).name);
data = load(A);
% Plot selected variable from each file in one figure
data{k} = data.Cycles.Cop_x_l_meancycle;
end
Now you have all data of files int he cell array data. You can access it, play with it to plot.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dates and Time 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!