Way to get handle to just brushed object?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi! I have a method which catches the windowButtonUp event when brushing. I'd like to use the handle to the plot object (i.e., not the axes it's a child of, but the line or surface object itself) that was just brushed, but I can't find how to retrieve it. I wrote some code to try to do it, but it behaves inconsistently; before I try further to debug it, I'd like to know that I'm not re-inventing the wheel: is there a convenient way of retrieving the handle to a just-brushed object? Thanks!
0 commentaires
Réponse acceptée
Sarah Wait Zaranek
le 26 Avr 2011
Not sure if this is what you are doing or not, but this seems to work for me. It works very nicely on lines (at least in my limited testing)
% find all objects with the property BrushData
hB = findobj(gcf,'-property','BrushData');
% extract the brush data
data = get(hB,'BrushData');
% find objects where BrushData is not all zeros (i.e. you have some points "brushed"). Note: this probably could be written in a cleaner fashion, but it shows you the idea. Then, index back into your list of objects and get the ones that were "brushed"
brushObj = hB(find(cellfun(@(x) sum(x),data)))
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interaction Control dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!