필터 지우기
필터 지우기

Unexpected number of function input arguments

조회 수: 1 (최근 30일)
KAE
KAE 2017년 6월 9일
편집: KAE 2017년 6월 9일
I am confused by "extra" function inputs in the program GUI_27 from the file exchange. Can you help me figure out where they come from? Here's the relevant lines,
% Here we pass in 1 argument, S, to a function accessed by the handle @fh_wbmfcn.
set(S.fh,'windowbuttonmotionfcn',{@fh_wbmfcn,S})
% Here is the start of function fh_wbmfcn which receives 1 argument in the line above
function [] = fh_wbmfcn(varargin)
% Yet when I put a breakpoint at this point to check, there were 3 inputs!
% varargin{1} is a handle to a figure that fh_wbmfcn will access, which we didn't pass in above
% varargin{2} is mouse data within that figure, which we didn't pass in above
S = varargin{3}; % The third argument is the structure S passed in above
I am confused why 3 inputs appear within fh_wbmfcn when it seems we only passed in 1 input. How did the other 2 inputs get in there?
  댓글 수: 1
KAE
KAE 2017년 6월 9일
편집: KAE 2017년 6월 9일
Walter's answer here indicates that these 2 additional inputs are expected because this is a graphics object callback. I do not know how to give him credit for the fact that his answer addressed the present question, but will leave this question up since it might help someone. If instead I should delete it, please let me know.

댓글을 달려면 로그인하십시오.

답변 (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