MATLAB: What is the code to plot several .dat files together

graphplotsimulation

I have 1000 .dat files and I want to plot graphs from them and save the results in .png format for all the files. How do we do that?

Best Answer

figure
hold on
datfiles = dir('*.dat');
for K = 1 : length(datfiles)
data = load(datfiles(k).name); %load just this file
% Plot the data depending on variables
end