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.

采纳的回答

Azzi Abdelmalek
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 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by