How to plot data from mutiple files in a loop so that all is collated in one figure?

1 visualización (últimos 30 días)
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

Respuesta aceptada

KSSV
KSSV el 21 de Jul. de 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.

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by