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

5 ビュー (過去 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 Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by