필터 지우기
필터 지우기

How can I plot a figure with 5 subplots and save it and then move to the next figure containing 5 subplots and save it under an other name?

조회 수: 11 (최근 30일)
Hy, I have a dataset of 100 columns (each columns represents one channel) 150000 rows.
Now I want to create 20 figures and each figure should show the data of 5 channels in subplots.
For example:
for i=1:5
h(i) = subplot(5,1,i);
plot(t,Ch0_99_OS1(:,i));
title(NewName(i));
ylabel('intensity [a. u.]');
xlabel('time [sec]');
ylim ([-1200 27000]);
end
Now I want to save the file as Ch1_5.png and start with the next figure containing the data from channel 6-10.
How can i do this?
Thanks

채택된 답변

Bob Thompson
Bob Thompson 2019년 5월 2일
You can assign a figure number with the figure command.
You can save a figure with the savefig command.
Just put them both, or the savefig, into a for loop and you should be good.
for f = 1:20;
for i=1:5
h(i) = subplot(5,1,i);
plot(t,Ch0_99_OS1(:,i+(j-1)*5));
title(NewName(i));
ylabel('intensity [a. u.]');
xlabel('time [sec]');
ylim ([-1200 27000]);
end
savefig(['myfigure',num2str(f),'.png']);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by