MATLAB Answers

how can I add label to rectangle object ?

115 views (last 30 days)
safa BY
safa BY on 3 Aug 2018
Commented: Sucharitha Chokkappa Gari on 8 Oct 2020 at 12:56
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


Sign in to comment.

Answers (1)

Eduard Reitmann
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.


Show 2 older comments
Eduard Reitmann
Eduard Reitmann on 6 Aug 2018
You are welcome. I hope it solved your problem.
Sucharitha Chokkappa Gari
Sucharitha Chokkappa Gari on 8 Oct 2020 at 12:56
this works for me
How do I do if I have 4 rectangles being plotted in loop and I want to name them as rect1, rect2...

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!