필터 지우기
필터 지우기

getting input through matlab mouse call backs

조회 수: 1 (최근 30일)
Sunil  Shahi
Sunil Shahi 2013년 7월 23일
here is what I have so far. I am trying to use mouse pointer to get certain values from the figure. say I have a function like this
function mouseCallback()
h = plot(rand(10,1), 'o-');
set(h, 'ButtonDownFcn',@mouseCall)
function mouseCall(~,~)
p = get(gca,'CurrentPoint');
p = p(1,1:2);
title( sprintf('(%g,%g)',p) )
end
end
the function works fine now all I want do is to call this function to get the 'p' from another function. something like
function p = mouseCallback()
.....
.....
end
the problem is when I do so execution of the function doesnot terminate as it waits for next mouse callback. Is there anyway to terminate the callback and get the value.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by