Move a 2D object and track its position through a gui
3 views (last 30 days)
Hey everyone, i was wondering, is there a way to move a 2D object and track its new position after you have plotted them using your mouse. I dont want to draw a rectangle over an image as in some other questions i saw. What i want is, lets say i have two 2D objects
h1 = rectangle('Position',[0.59,0.35,3.75,1.37],...
h2 = rectangle('Position',[1.59,5.35,2.75,4.37],...
and a function that calculates the distance from their centers, i want do be able to move the one or the other using my mouse and the distance to be updated while i move them.
In my case i use this method to create some rectangles
for i = 1:compnum
where compos is a matrix that stores the position of the rectangles and list is a matrix with the dimentions they have.
Finally i use this code to print the distance of the two components
I thought it would be nice if i could merge all this into a single object and then be able to move it using my mouse.
Thanks in advance.