Variable 'data' does not update in main script

7 Ansichten (letzte 30 Tage)
Abdul Basit Jaweed
Abdul Basit Jaweed am 19 Sep. 2017
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

Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by