필터 지우기
필터 지우기

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