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

조회 수: 3 (최근 30일)
Sandy
Sandy 2012년 11월 30일
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.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 30일
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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 11월 30일

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by