button_clicked.m

来自「基本的matlab编程源代码」· M 代码 · 共 18 行

M
18
字号
function button_clicked

% Declare and initialize variable to store the count
persistent count
if isempty(count)
   count = 0;
end

% Update count
count = count + 1; 

% Create new string
str = sprintf('Total Clicks: %d',count);

% Find the text field and update the text
Hndl = findobj(gcbf,'Tag','StaticText1');
set (Hndl,'String',str);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?