Can't get windowButtonMotionFcn to work
古いコメントを表示
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?
2 件のコメント
Adam
2016 年 6 月 8 日
You need to show some code, there is too little information here to understand what the setup is.
Toby Jackson
2016 年 6 月 8 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!