필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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

채택된 답변

KSSV
KSSV 2022년 7월 21일
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개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by