matlab - Get Normalized Location of Mouse in Figure -
i trying current mouse position of mouse through 'windowbuttondownfcn'
given below code :
f = figure(1); set(f,'windowbuttondownfcn',@mouselocation) uiwait(f) function mouselocation(source,callback) get(source,'currentpoint') end
when click current position of mouse not normalized tried:
get(source,'currentpoint','units','normalized')
but seem give me error that
too many input arguments.
you can use hgconvertunits
convert between figure's (or graphic object's) current units , normalized units.
pt = hgconvertunits(source, [get(source, 'currentpoint') 1 1], ... get(src, 'units'), 'normalized', source); pt = pt(1:2);
alternately, can change figure's units
normalized
, currentpoint
returned in normalized units automatically.
fig = figure('units', 'normalized'); get(source, 'currentpoint')
Comments
Post a Comment