
% get current point and positions take care of units Since ginput is not editable, I copied all content into a function, and changed the call to ginput to the new function instead.īelow is the modification to ginput. Here is some example code that moves the ellipse following the mouse pointer. What I have found that can move is annotation. An undocumented function hgconvertunits is used to ensure the units are of desired type.People are working around the limit of drawing functions such as insertShape found in a toolbox, which is the fact that the circle is burnt into the image and there is no easy way to "move" it.% 1: horizontal left, 2: horizontal right, 3: vertical bottom, 4: vertical topĬrossHair(k) = uicontrol(fig, 'Style', 'text'. % Create thin uicontrols with black backgrounds to simulate fullcrosshair pointer. Set(crossHair(4), 'Position', ) įunction crossHair = createCrossHair(fig) If cp(1) figWidth-gap || cp(2)>figHeight-gap % Early return if point is outside the figure Gap = 3 % 3 pixel view port between the crosshairsĬp = hgconvertunits(fig,, fig.Units, 'pixels', fig) įigPos = hgconvertunits(fig, fig.Position, fig.Units, 'pixels', fig.Parent) In the particular version that I have, ginput has its crosshair code mainly in two functions: function updateCrossHair(fig, crossHair) I am using Matlab R2015b and I do not know if ginput has been modified since then.
