フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

the problem of callback function creating a control by uicontrol function

2 ビュー (過去 30 日間)
deng
deng 2016 年 8 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
if true
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
global aryData
scrsz = get(0,'ScreenSize') %获取显示器屏幕尺寸
f_size= [scrsz(3)/15 0.2*scrsz(4) 0.6*scrsz(3) 0.7*scrsz(4)]
hf=figure('Name','图1','Position',f_size);
set(hf,'NumberTitle','off') %隐藏数字标题即左上角的“Figure1,2..”
set(hf,'NumberTitle','on') %显示数字标题
set(hf,'Menubar','No') %隐藏菜单栏
set(hf,'Menubar','Figure')%显示菜单栏
hb = uicontrol(hf, 'style', 'pushbutton', ...
'units', 'normalized', ...
'position', [0.75,0.8,0.2,0.1], ...
'string', '对比',...
'Callback', @pbCompare);
%%%%-----------------------------------------
function pbCompare
global aryData
global totalTimes
msgbox('sucess')
disp 'sucess'
%%------------------------------------
end
pbCompare callback function cannot be performed. why? think you very muchu. email:dengshuaiqi@163.com

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 8 月 7 日
Callbacks must accept at least two arguments. They can ignore them but they must accept them. You can use varargin for this purpose.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by