I have a set of rectangles in a figure. I'm tagging them by a rect_tag index, and I want to get an array (or cell array) which has the tags of clicked rectangles. The rectangles are generated by:
for i_nf=1:nRects
rect_tag = ['rectangle_num_' num2str(i_nf)];
rectangle('Position', rectanglesMat(i_nf,:), 'Tag', rect_tag, 'ButtonDownFcn', {@add_rectangle});
end
How do I define the add_rectangle function to accomplish this?