test_listbox_callback.m
来自「基本的matlab编程源代码」· M 代码 · 共 22 行
M
22 行
function test_listbox_callback(action)
switch action
case 'button'
Hndl = findobj(gcbf,'Tag','Listbox1');
value = get (Hndl,'Value');
Hndl = findobj(gcbf,'Tag','Label1');
str = ['Option ' num2str(value)];
set (Hndl,'String',str);
case 'list'
% If this was a double click, update the label.
selectiontype = get(gcf,'SelectionType');
if selectiontype(1) == 'o'
Hndl = findobj(gcbf,'Tag','Listbox1');
value = get (Hndl,'Value');
Hndl = findobj(gcbf,'Tag','Label1');
str = ['Option ' num2str(value)];
set (Hndl,'String',str);
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?