Export multiple figures in a directory

1 Ansicht (letzte 30 Tage)
Ionut  Anghel
Ionut Anghel am 9 Jul. 2015
Beantwortet: Azzi Abdelmalek am 9 Jul. 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.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 9 Jul. 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

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by