Borrar filtros
Borrar filtros

Unexpected number of function input arguments

1 visualización (últimos 30 días)
KAE
KAE el 9 de Jun. de 2017
Editada: KAE el 9 de Jun. de 2017
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 comentario
KAE
KAE el 9 de Jun. de 2017
Editada: KAE el 9 de Jun. de 2017
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by