plotting data from data files and saving each plot through out each run of the loop
조회 수: 2 (최근 30일)
이전 댓글 표시
hello guys im trying to plot data from different dat files that have different parameters C (used to identity the file) throghout each run of the loop. For some reason im only getting one plot. Please help
below is what i did.
******************************************************************************************
Cpara=[0.02, 0.03, 0.04, 0.05, 0.06, 0.015, 0.025, 0.035, 0.045, 0.055];
for k = Cpara
file = importdata(strcat('A=0.12_B=2_C=',mat2str(k),'_hnull_2.1_t0.01e.dat'));
plot(file(:,1),file(:,2))
end
댓글 수: 0
채택된 답변
David K.
2019년 9월 12일
If you wish to have all the plots on the same figure, you need to use
figure;
hold on
%The rest of your code
If you wish to have multiple figures you need to do
for k = Cpara
file = importdata(strcat('A=0.12_B=2_C=',mat2str(k),'_hnull_2.1_t0.01e.dat'));
figure
plot(file(:,1),file(:,2))
end
What you were doing was just replacing each plot with the next one instead of creating new figures.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!