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
0 个评论
采纳的回答
Bob Thompson
2019-5-2
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 Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!