Export multiple figures in a directory

1 vue (au cours des 30 derniers jours)
Ionut  Anghel
Ionut Anghel le 9 Juil 2015
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.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 9 Juil 2015
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

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by