Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2008-01-15
年龄: 42
帖子: 6
声望力: 0 ![]() |
![]()
我是个matlab初学者,正在学习GUI方面的知识。我做了一个简单计算的界面,但是不会参数传递。在此请求能得到大家的帮助。谢谢你们了!!!
这段是 编辑界面的程序 Text(4)=uicontrol(f6,'units','normalized','backgroundcolor','g','style','text','string','螺旋叶片的导程计算','fontsize',9,'fontweight','bold','position',[0.3,0.38,0.3,0.05]); Pubutt(48)=uicontrol(f6,'units','normalized','backgroundcolor',[0.7 0.7 0.7],'style','pushbutton','string','滚筒的有效直径(m)','fontsize',9,'fontweight','bold','position',[0.1,0.26,0.44,0.07]); Pubutt(49)=uicontrol(f6,'units','normalized','backgroundcolor',[0.7 0.7 0.7],'style','pushbutton','string','螺旋叶片的螺旋升角(度)','fontsize',9,'fontweight','bold','position',[0.1,0.16,0.44,0.07]); Edit(48)=uicontrol(f6,'units','normalized','backgroundcolor','w','style','edit','string',[],'position',[0.59,0.26,0.15,0.07]); Edit(49)=uicontrol(f6,'units','normalized','backgroundcolor','w','style','edit','string',[],'position',[0.59,0.16,0.15,0.07]); h_confirm9=uicontrol(f6,'units','normalized','style','pushbutton','string','计算','fontsize',9,'fontweight','bold','position',[0.5,0.04,0.2,0.1],'callback',@confirm9); Edit(50)=uicontrol(f6,'units','normalized','backgroundcolor','w','style','edit','string',[],'position',[0.7,0.04,0.2,0.1],'visible','off'); hu(6)=uipanel(f6,'position',[0.07,0.04,0.88,0.43]); function confirm9(obj,event) set(Edit(50),'visible','on') end end 相应的计算所用的function 函数文件我也写了一个,如下 function Dsr=youxiaozhijing(D,lp) % Dsr为滚筒的有效直径 % D为滚筒直径 % lp为截齿露出齿座外在滚筒径向上的长度值 Dsr=0.5*(D+D-2*lp) end |
![]() |
![]() |
![]() |
#2 |
初级会员
注册日期: 2008-01-15
年龄: 42
帖子: 6
声望力: 0 ![]() |
![]()
这是界面的截图,当输入那两个参数的时候,怎么调用function函数,实现它的计算,并将计算结果显示在计算按钮后面的那个空白text 控件里
|
![]() |
![]() |
![]() |
#3 |
高级会员
注册日期: 2008-09-14
年龄: 43
帖子: 351
声望力: 24 ![]() |
![]()
要么没有返回值 要么值没有连接 后者可能性大
__________________
qq604443022 |
![]() |
![]() |