get axis value of a subplot
53 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Max Müller
le 28 Juil 2014
Commenté : Azzi Abdelmalek
le 11 Août 2014
hey Guys
I ve created a program which creates 9 different subplots with 3 different plot lines. My Questions is: how can i get the x andy values of each subplot.
for example: One of the titles of my plot is simply A. Another is B. How can i get the values in an array which has the same name.
Thanks
2 commentaires
Azzi Abdelmalek
le 11 Août 2014
Max , please don't add all these answers, if you want to add a comment , just under my answer or someone else's answer, click on comment on this answer
Réponse acceptée
Azzi Abdelmalek
le 28 Juil 2014
Modifié(e) : Azzi Abdelmalek
le 28 Juil 2014
% -----Example----------------------
x=repmat((1:10)',1,9);
y=rand(10,9);
for k=1:9
subplot(3,3,k);
plot(x(:,k),y(:,k));
end
%------The code-----------------------
h=findobj(gcf,'type','axes');
for k=1:9
f=get(h(k),'children');
xi{k}=get(f,'xdata');
yi{k}=get(f,'ydata');
end
outx=fliplr(cell2mat(xi')');
outy=fliplr(cell2mat(yi')');
%-------------test --------------------
isequal(x,outx)
isequal(y,outy)
Plus de réponses (3)
Voir également
Catégories
En savoir plus sur Line 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!