matlab uicontrol 居中,在uicontrol属性中position设置问题?

知道figure属性中position的位置:是从左下角开始,X,Y,长,宽;

但是针对uicontrol中的position设置的方式,大小依据不太明白,能讲解一下否?

例如下段程序:

hf=figure('Color',[0,1,1],'Position',[200,200,400,200],...

'Name','数制转换','NumberTitle','off','MenuBar','none');

uicontrol(hf,'Style','Text', 'Units','normalized',...

'Position',[0.05,0.8,0.45,0.1],'Horizontal','center',...

'String','输 入 框','Back',[0,1,1]);

uicontrol(hf,'Style','Text','Units','normalized',...

'Position',[0.5,0.8,0.45,0.1],'Horizontal','center',...

'String','输 出 框','Back',[0,1,1]);

uicontrol(hf,'Style','Frame','Units','normalized',...

'Position',[0.04,0.33,0.45,0.45],'Back',[1,1,0]);

uicontrol(hf,'Style','Text','Units','normalized',...

'Position',[0.05,0.6,0.25,0.1],'Horizontal','center',...

'String','十进制数','Back',[1,1,0]);

uicontrol(hf,'Style','Text','Units','normalized',...

'Position',[0.05,0.4,0.25,0.1],'Horizontal','center',...

'String','2~16进制','Back',[1,1,0]);

he1=uicontrol(hf,'Style','Edit','Units','normalized',...

'Position',[0.25,0.6,0.2,0.1],'Back',[0,1,0]);

he2=uicontrol(hf,'Style','Edit','Units','normalized',...

'Position',[0.25,0.4,0.2,0.1],'Back',[0,1,0]);

uicontrol(hf,'Style','Frame','Units','normalized',...

'Position',[0.52,0.33,0.45,0.45],'Back',[1,1,0]);

ht=uicontrol(hf,'Style','Text','Units','normalized',...

'Position',[0.6,0.5,0.3,0.1],'Horizontal','center','Back',[0,1,0]);

COMM=['n=str2num(get(he1,''String''));','b=str2num(get(he2,''String''));',...

'dec=trdec(n,b);','set(ht,''string'',dec);'];

uicontrol(hf,'Style','Push','Units','normalized',...

'String','转 换','Position',[0.18,0.1,0.2,0.12],'Call',COMM);

uicontrol(hf,'Style','Push','Units','normalized',...

'String','退 出','Position',[0.65,0.1,0.2,0.12],'Call','close(hf)');

谢谢各位!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值