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

Illustration
hardikisharma2 - 2020-09-11T14:00:00+00:00
Question: How to make a simple plot (loading many files)?

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

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

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


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!