tianya6421
2009-04-12, 09:53
我是个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
这段是 编辑界面的程序
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