Way to get handle to just brushed object?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Sarah Wait Zaranek
2011 年 4 月 26 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interaction Control についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!