how can I add label to rectangle object ?

28 ビュー (過去 30 日間)
safa BY
safa BY 2018 年 8 月 3 日
コメント済み: Eduard Reitmann 2018 年 8 月 6 日
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

回答 (1 件)

Eduard Reitmann
Eduard Reitmann 2018 年 8 月 3 日
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 件のコメント
safa BY
safa BY 2018 年 8 月 6 日
thanks a lot
Eduard Reitmann
Eduard Reitmann 2018 年 8 月 6 日
You are welcome. I hope it solved your problem.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by