how can I add label to rectangle object ?
36 views (last 30 days)
Show older comments
My code : rect=rectangle('Position',pos);
draggable(rect); set(rect,'FaceColor','none','EdgeColor','g','LineWidth',6);
And now I want to add a label to the rectangle
0 Comments
Answers (1)
Eduard Reitmann
on 3 Aug 2018
I am not familiar with the 'draggable' function, but this should give you a text box in the middle of the square.
text(pos(1)+pos(3)/2,pos(2)+pos(4)/2,'Title','HorizontalAlignment','center')
4 Comments
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!