필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

for loop problem

조회 수: 1 (최근 30일)
Rok mr
Rok mr 2012년 5월 9일
마감: MATLAB Answer Bot 2021년 8월 20일
Hellow, here is my code, which is not working correctly:
ff=...
for i=[10 11 22 53:55]
Dataimp= importdata(sprintf('xxxx', i));
for j=1:6
subplot(3,2,j)
plot(Data(:,1),Data(:,2),'r'), hold on
title(sprintf('fg = %03.2f Hz',ff(i)))
end
end
I would like to have 6 subplots with graphs obtained from a different data from txt files which are not named 1:6 I could change the names but I have 60 files and I would like to plot just those I choose. On each subplot should be a plot from data in certain txt file and it's own title.
Thanks for your help in advance!

답변 (1개)

Oleg Komarov
Oleg Komarov 2012년 5월 9일
sel = [10 11 22 53:55];
for i = 1:6
Data = importdata(sprintf('xxxx', sel(i)));
subplot(3,2,i)
plot(Data(:,1),Data(:,2),'r'), hold on
title(sprintf('fg = %03.2f Hz',ff(i)))
end

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by