楼主试试这个程序:
function [] = GUI_1()
S.fh = figure('units','pixels',...
'position',[300 300 300 100],...
'menubar','none',...
'name','GUI_5',...
'numbertitle','off',...
'resize','off');
S.pb = uicontrol('style','push',...
'unit','pix',...
'position',[20 10 260 30],...
'string','Adder');
S.tx = uicontrol('style','text',...
'unit','pix',...
'position',[20 50 260 30],...
'fontsize',16,...
'string','0');
S.n=0;
set(S.pb,'callback',{@pb_call,S}) % Set the callback for pushbutton.
function [] = pb_call(varargin)
% Callback for the pushbutton.
S = varargin{3}; % Get the structure.
T = get(S.tx,'string'); % Get the current string.
S.n=S.n+1;
T=strcat(T,num2str(S.n));
set(S.tx,'str',T); % Delete the last character in string.
set(S.pb,'callback',{@pb_call,S}) % Save the new count.