Effacer les filtres
Effacer les filtres

How to make a simple plot (loading many files)?

1 vue (au cours des 30 derniers jours)
Sandy
Sandy le 30 Nov 2012
I have a series of data files (*.dat). They each contain two columns of data (magnitude and time). I need to load in all of these files into Matlab, then plot magnitude vs time for all of these files, in one single plot. I'm not good with loop functions that's why I need some help. Thank you.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 30 Nov 2012
f=struct2cell(dir('yourfolder/*.dat'));
name=f(1,:)
figure;
hold on
for k=1:numel(name)
v=dlmread(name{k});
plot(v(:,1),v(:,2))
end

Plus de réponses (1)

Walter Roberson
Walter Roberson le 30 Nov 2012

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by