Variable 'data' does not update in main script

I am working on acquiring mouse cursor data on matlab. Function 'mouseMove' is create for this purpose. function is working very well and current mouse cursor value is also retrieve. but I want to acquire that cursor value on main script which is update as the mouse move. But problem is that mouse cursor value in variable 'data' which is calling the function , is not updating the values as the cursor move
This my main code/script.
%%For single image
img = imread('pic.jpg'); %Read the image
imshow(img); % Show the image
temp = @mouseMove; % Create Function Handle
set (gcf, 'WindowButtonMotionFcn', temp); % Data map on plot figure
data = temp() % Acquire the mouse cursor data
this my function
function result = mouseMove (object, eventdata)
result = get (gca, 'CurrentPoint');
title(gca, ['(X,Y) = (', num2str(result(1,1)), ', ',num2str(result(1,2)), ')']);
end

답변 (0개)

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2017년 9월 19일

편집:

2017년 9월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by