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

조회 수: 6 (최근 30일)
Zak Kankin
Zak Kankin 2016년 1월 13일
댓글: Zak Kankin 2016년 1월 13일
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

채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 13일
Change @obj.disp to
@(src,event) obj.disp
Callbacks must accept the two parameters automatically provided by MATLAB.

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