资源描述:
《matlab实例33》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实例33:曲线转换按钮h0=figure('toolbar','none',... 'position',[200150450250],... 'name','实例33');x=0:0.5:2*pi;y=sin(x);h=plot(x,y);gridonhuidiao=[... 'ifi==1,',... 'i=0;,',... 'y=cos(x);,',... 'delete(h),',... 'set(hm,''string'',''正弦函数''),',... 'h=plot(x,y);,',...
2、 'gridon,',... 'elseifi==0,',... 'i=1;,',... 'y=sin(x);,',... 'set(hm,''string'',''余弦函数''),',... 'delete(h),',... 'h=plot(x,y);,',... 'gridon,',... 'end,',... 'end'];hm=uicontrol(gcf,'style','pushbutton',... 'string','余弦函数',... 'callback',huidiao);
3、i=1;set(hm,'position',[250206020]);set(gca,'position',[0.20.20.60.6])title('按钮的使用')holdon实例34:栅格控制按钮h0=figure('toolbar','none',... 'position',[200150450250],... 'name','实例34');x=0:0.5:2*pi;y=sin(x);plot(x,y)huidiao1=[... 'set(h_toggle2,''value'',0),',...
4、'gridon,',... ];huidiao2=[... 'set(h_toggle1,''value'',0),',... 'gridoff,',... ];h_toggle1=uicontrol(gcf,'style','togglebutton',... 'string','gridon',... 'value',0,... 'position',[20455020],... 'callback',huidiao1);h_toggle2=uicontrol(gcf,
5、'style','togglebutton',... 'string','gridoff',... 'value',0,... 'position',[20205020],... 'callback',huidiao2);set(gca,'position',[0.20.20.60.6])title('开关按钮的使用')实例35:编辑框的使用h0=figure('toolbar','none',... 'position',[200150350250],... 'name','实例35');f='Pleasein
6、puttheletter';huidiao1=[... 'g=upper(f);,',... 'set(h2_edit,''string'',g),',... ];huidiao2=[... 'g=lower(f);,',... 'set(h2_edit,''string'',g),',... ];h1_edit=uicontrol(gcf,'style','edit',... 'position',[10020010050],... 'HorizontalAlignmen
7、t','left',... 'string','Pleaseinputtheletter',... 'callback','f=get(h1_edit,''string'');',... 'background','w',... 'max',5,... 'min',1);h2_edit=uicontrol(gcf,'style','edit',... 'HorizontalAlignment','left',... 'position',[10010010050],... 'background','w'
8、,... 'max',5,... 'min',1);h1_button=uicontrol(gcf,'style','pushbutton',... 'string','小写变大写',...