Making loop to create graphs

1 次查看(过去 30 天)
Lia Kirtadze
Lia Kirtadze 2022-8-19
回答: Voss 2022-8-19
I have multiple .txt files with inone folder and I am making graphs based on this data
Is it possible to make some kind of loop to make matlab do it automaticlly.

回答(1 个)

Voss
Voss 2022-8-19
Something along these lines:
folder = 'your\folder\path';
files = dir(fullfile(folder,'*.txt'));
hold on
for ii = 1:numel(files)
data = readmatrix(fullfile(folder,files(ii).name));
plot(data(:,1),data(:,2));
end

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by