Effacer les filtres
Effacer les filtres

how can i have three plots on one graph and save all three plots using one name

1 vue (au cours des 30 derniers jours)
I have a loop with four files, how can i have three plots on one graph and save all three plots using each filename? so i get four different plot with three plots on each. i tried
h=plot(f,x)
hold on
h=plot(f,y)
hold on
h=plot(f,z)
saveas(h,name,'jpg')
but i get all plots on the same graph for all four files i.e 12 plots on one graph

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 12 Août 2012
Modifié(e) : Azzi Abdelmalek le 12 Août 2012
%for example
f=0:0.1:10;n=length(t);x=rand(4,n);y=rand(4,n);z=rand(4,n);
for k=1:4
h=plot(f,x(k,:));
hold on;h=plot(f,y(k,:));
hold on;h=plot(f,z(k,:))
name=sprintf('fic%d',k)
saveas(h,name,'jpg')
close
end

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots 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