test_toggle.m
资源名称:matlab编程.zip [点击查看]
上传用户:zjhyt3
上传日期:2007-07-03
资源大小:89k
文件大小:1k
源码类别:
matlab例程
开发平台:
Matlab
- function test_toggle()
- % This function creates a toggle button and a text field.
- % The the associated callback will cause the text
- % field to display the state of the toggle button.
- h0 = figure('Color',[0.8 0.8 0.8], ...
- 'Name','Test Toggle Button', ...
- 'NumberTitle','off', ...
- 'Position',[300 300 257 136], ...
- 'Tag','Fig1');
- h1 = uicontrol('Parent',h0, ...
- 'Units','points', ...
- 'BackgroundColor',[0.8 0.8 0.8], ...
- 'Position',[45 45 70 17], ...
- 'String','Off', ...
- 'Style','text', ...
- 'Tag','Label1');
- h1 = uicontrol('Parent',h0, ...
- 'Units','points', ...
- 'Callback','test_toggle_callback', ...
- 'Position',[45 25 70 17], ...
- 'String','Toggle Button', ...
- 'Style','togglebutton', ...
- 'Value',0, ...
- 'Tag','Toggle1');