This is my first time working on matlab gui and to be honest I don't know what I'm doing. Hopefully I can provide enough information to solve this. Below are the relevant parts of my program.
classdef title < handle % code
methods function obj = title(dirname) % code
figH = figure(... 'WindowButtonMotionFcn' , @mouse); end %
function mouse(obj, hObj, varargin); obj_han = get(hObj, 'currentpoint'); set(obj.handles.cursorX, 'String', num2str(obj_han(1))); set(obj.handles.cursorY, 'String', num2str(obj_han(2))); end end
"Undefined function 'mouse' for input arguments of type 'matlab.ui.Figure'. Error while evaluating Figure WindowButtonMotionFcn"
If I leave the code of 'mouse' unchanged but change the function to:
function mouse(hObj, varargin);
and define it within function obj = title(dirname), then it works until a call to mouseButtonDwn (which executes changing WindowButtonMotionFcn to a different function, then resets WindowButtonMotionFcn to @mouse). After this the error is the same as the above.
What can I do here?
Best Answer