Export multiple figures in a directory
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I have this piece of code:
clear all;
close all;
x=(1:1:50);
y=x.^2;
z=x.^3;
t=-10*z;
aaa=[y; z; t];
for i=1:size(aaa,1);
figure(i);
plot(x,aaa(i,:));
xlabel('Time [s]','FontSize',15);
if i==1
axis([0 30 0 1000]);
ylabel('Temp[K]','FontSize',15);
else if i==2
axis([0 35 0 60000]);
ylabel('Heat[W]','FontSize',15);
else if i==3
axis([0 40 -60000 0]);
ylabel('Flow[Kg/s]','FontSize',15);
end
end
saveas(gcf,'H:\MATLAB\PI610_fig\APRM_fig022.png');
end
end
How can I export multiple figures having a predefined path, cutting also the blak space(Here Aprmfig022.png is overwritten)? Thank you.
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2015년 7월 9일
close all;
x=(1:1:50);
y=x.^2;
z=x.^3;
t=-10*z;
aaa=[y; z; t];
for i=1:size(aaa,1);
figure(i);
plot(x,aaa(i,:));
xlabel('Time [s]','FontSize',15);
if i==1
axis([0 30 0 1000]);
ylabel('Temp[K]','FontSize',15);
elseif i==2
axis([0 35 0 60000]);
ylabel('Heat[W]','FontSize',15);
elseif i==3
axis([0 40 -60000 0]);
ylabel('Flow[Kg/s]','FontSize',15);
end
saveas(gcf,sprintf('H:\MATLAB\PI610_fig\APRM_fig%d.png',i))
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!