How can I get the draggable rectangles using FINDOBJ in MATLAB 7.11 (R2010b)?

1 view (last 30 days)
I want to get the draggable rectangles by using FINDOBJ function:
figure
imrect(gca, [10 10 50 50]);
databox=findobj(gca, 'Type', 'imrect');
But it does not work as the variable databox returns an empty matrix.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Aug 2011
The issue is that with FINDOBJ, there is no value called 'imrect' in the 'Type' property. To find all the draggable rectangles in the figure, please replace following code in your program:
databox = findobj(gca, 'Type', 'imrect');
with:
databox = findobj(gca, 'Type', 'hggroup', 'Tag', 'imrect');
As you can see, the draggable rectangle is a group object.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R2010b

Community Treasure Hunt

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

Start Hunting!