Update a text object's position used with a movable rectangle.

1 visualizzazione (ultimi 30 giorni)
Quick question,
Lets say i have created a rectangle using
h(i) = imrect(gca, [1,1,4,4]);
and then i add a text object with the rectangles name or some data
text(1,1,num2str(1),'BackgroundColor',[.7 .9 .7],'FontSize',7);
How can i make the text follow the rectangle at its final position after i move it?

Risposta accettata

Walter Roberson
Walter Roberson il 19 Lug 2012
You might be able to do it by registering a listener on the imrect position, with the callback changing the rectangle position.
There is no standard mechanism for doing this. The closest would be linkprop() but that is for identical property names and meaning; I doubt you want the text() size to be as big as the rectangle.
  3 Commenti
Raldi il 19 Lug 2012
I fixed that to, using
nt=function numtagUpdate(rawdata,nt,draggedComp)
Thanks for he help though.

Accedi per commentare.

Più risposte (0)


Scopri di più su Labels and Annotations in Help Center e File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by