• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

matlab脚本 gui设计基础

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
h0 = figure(\'toolbar\',\'none\',...
    \'position\',[200 150 450 250],...
    \'name\',\'gui_mytry\',...
    \'numbertitle\',\'off\');
x = 0:0.5:2*pi;
y = sin(x);
h = plot (x,y);
grid on;
hm = uicontrol(h0,\'style\',\'text\',...
    \'string\',\'绘图函数\',...
    \'position\',[380 180 50 20]);
hm =uicontrol(h0,\'style\',\'popupmenu\',...
    \'string\',...
    \'sin(x)|cos(x)|sin(x)+cos(x)\',...
    \'position\',[380 150 50 20]);
set(hm,\'value\',1)
my_callback = [...
    \'v=get(hm,"value");,\',...
    \'switch  v,\',...
    \'case 1,\',...
    \'delete(h),\',...
    \'y = sin(x);,\',...
    \'h = plot(x,y);,\',...
    \'grid on,\'...
   \'case 1,\',...
    \'delete(h),\',...
    \'y = sin(x);,\',...
    \'h = plot(x,y);,\',...
    \'grid on,\'...
    \'case 2,\',...
    \'delete(h),\',...
    \'y = cos(x);,\',...
    \'h = plot(x,y);,\',...
    \'grid on,\'...
     \'case 3,\',...
    \'delete(h),\',...
    \'y = sin(x)+cos(x);,\',...
    \'h = plot(x,y);,\',...
    \'grid on,\'...
    \'end\'];
set(hm,\'callback\',my_callback);
set(gca,\'position\',[0.2 0.2 0.6 0.6]);

  

function[] = example();
S.fh=figure(\'units\',\'normalized\',...
    \'position\',[0.1 0.1 0.3 0.3],...
    \'menubar\',\'none\',...
    \'name\',\'exmaple\',...
    \'numbertitle\',\'off\',...
    \'resize\',\'off\');
S.text=uicontrol(\'style\',\'text\',...
    \'unit\',\'normalized\',...
    \'position\',[0.1 0.85 0.4 0.05],...
    \'string\',\'change color\');
S.pop=uicontrol(\'style\',\'popupmenu\',...
    \'unit\',\'normalized\',...
    \'position\',[0.6 0.8 0.3 0.1],...
    \'string\',{\'red\';\'green\';\'blue\';...
        \'yellow\';\'black\';\'cyan\';\'magenta\'});
S.axes = axes(\'unit\',\'normalized\',...
    \'position\',[0.1 0.1 0.8 0.7]);
x=0:pi/50:8*pi;
y=sin(x);
axes(S.axes);
S.hplot=plot(x,y,\'color\',[1 0 0]);
set(S.pop,\'callback\',{@mycallback,S});
   
function mycallback(obj,event,S)
val = get(obj,\'Value\');
switch val 
    case 1
        set(S.hplot,\'color\',[1 0 0]);
    case 2
        set(S.hplot,\'color\',[0 1 0]);
    case 3
        set(S.hplot,\'color\',[0 0 1]);
    case 4
        set(S.hplot,\'color\',[1 1 0]);
    case 5
        set(S.hplot,\'color\',[0 0 0]);
    case 6
        set(S.hplot,\'color\',[0 1 1]);
    case 7
        set(S.hplot,\'color\',[1 0 1]);
end
        
        

    

  


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi2009智能指针0.21b版发布时间:2022-07-18
下一篇:
delphiAdo执行带有冒号字符语句的处理。发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap