How I can use some object method for uicontrol callback function?

For example, I want create a figure in object method, but how than I can call some method from this figure?
classdef test
methods
function disp(obj)
disp('hello')
end
function makeFig(obj)
figure;
uicontrol('style','pushbutton','callback',@obj.disp) % don't work
end
end
end

 Respuesta aceptada

Change @obj.disp to
@(src,event) obj.disp
Callbacks must accept the two parameters automatically provided by MATLAB.

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Preguntada:

el 13 de En. de 2016

Comentada:

el 13 de En. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by