Way to get handle to just brushed object?

11 visualizaciones (últimos 30 días)
David Goldsmith
David Goldsmith el 15 de Abr. de 2011
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!

Respuesta aceptada

Sarah Wait Zaranek
Sarah Wait Zaranek el 26 de Abr. de 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)))

Más respuestas (0)

Categorías

Más información sobre Interaction Control en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by