How to disable call back till I am done with Call back function
Show older comments
I have a call back function for capturing mouse moment.
set(gcf, 'WindowButtonMotionFcn', {@myCallBack, handles});
Inside the call back function I do some calculations.
function myCallBack(varargin)
hObject = varargin{1};
mpos = get(hObject,'CurrentPoint');
x = mpos(1);
y = mpos(2);
%perform a complex calculation
varargin{3}.robot.MoveRobotxy(x,y);
The calculation performing is time intensive. Therefore when i run the code, callback function stop working after few seconds. Same thing happens when I put a 2 second pause instead calculations inside the call back.
pause(2)
How do I avoid this? Is there a way to disable the call back till I am done with processing everything inside call back function?
Thank you
1 Comment
Stephen23
on 1 Nov 2017
It is not clear what you want to achieve: once the callback has been triggered, it will run... and that will take how ever long the code will take. When exactly would you want to "disable" the callback? Are you trying to prevent it from being triggered again, once it is running?
This might be of interest:
Accepted Answer
More Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!