How to plot data from mutiple files in a loop so that all is collated in one figure?
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
KSSV
on 21 Jul 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 Comments
More Answers (0)
See Also
Categories
Find more on Dates and Time 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!