Where are all drawn shapes stored from an axis?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Joseph Henry
le 16 Juil 2019
Modifié(e) : Adam Danz
le 19 Juil 2019
Let's say that I have an axis and I draw three shapes on it using drawrectangle.
Is there some way to call an array that holds the handles to each of these shapes?
Thanks
1 commentaire
Adam
le 16 Juil 2019
If you store them when you call drawrectangle and keep the output argument, yes.
Réponse acceptée
Adam Danz
le 16 Juil 2019
Modifié(e) : Adam Danz
le 19 Juil 2019
Store handles
In the block below, r1, r2, & r3 are handles to the 3 rectangles.
figure()
r1 = rectangle('Position',[0 0 2 4],'Curvature',0.2);
hold on
axis equal
r2 = rectangle('Position',[3 0 2 4],'Curvature',1);
r3 = rectangle('Position',[6 0 2 4],'Curvature',[0.5,1]);
Retrieve handles if they aren't stored
The line below search for objects of type "rectangle" in the current axes. For the plot created above, r would be a vector of object handles of size [3x1].
r = findobj(gca, 'Type', 'rectangle');
0 commentaires
Plus de réponses (0)
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!