How to return value from an axes ?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
yogesh jain
le 29 Fév 2016
Réponse apportée : Deependra Mishra
le 13 Déc 2018
Hello all, How to return value of an axes in GUI, which is typically a numeric value. That value can be used to handle the axes outside the axes function also. thank you
0 commentaires
Réponse acceptée
Walter Roberson
le 29 Fév 2016
As of R2014b, graphics handles are no longer numeric values. There is not a lot of reason to need a numeric value for a graphics handle: you can just store and pass around the object-oriented handle instead.
If you really really need to get to the numeric value for some reason, then you can double() the object-oriented handle, but be warned that if you do so the recipients cannot make use of that to refer to the axes, not without using handle() on it. The only reason I have ever had for needing to know the numeric value of a graphics handle (other than a figure handle) is for debugging.
If you want to know the handle of the "current" axes, then call gca()
If you built the axes using GUIDE, and gave it a Tag, then you can pull its handle out of the "handles" structure by using the Tag as a field name.
If you create the axes at run-time, then record its handle and pass that around as needed
ax1 = axes('Units', 'norm', 'Position', [0 0 .3 .3]);
....
do_something_with_an_axes(ax1)
If you want to know the axes that a particular drawing object such as a lineseries object, then you can use ancestor(HandleOfGraphicsObject, 'axes')
If you created the axes with a Tag and the Tag is unique, you can findobj() or findall() against the Tag to find the axes. (If the tag is not unique, you would get all of the objects with the tag.) This is slower than the alternatives listed above, but can be very convenient.
2 commentaires
Walter Roberson
le 29 Fév 2016
Nothing I have written is any different for GUI, other than the fact that when I am writing a GUI I would be even less likely to look at the numeric value of a handle and more likely to store the handles and refer to the stored handles.
Plus de réponses (1)
Deependra Mishra
le 13 Déc 2018
Here is a link I found, anyone one who come across this might want to have a look at...
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Object Properties 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!