function test1 ()
clc;
clear all;
figSize = [.6 .9];
figPos =[(1-figSize)/2 figSize];
hfig=figure(...
'Units','normalized',...
'Menubar','none',...
'Toolbar','none',...
'NumberTitle','off',...
'Name','层次分析法',...
'Position',figPos,...
'Visible','on' );
hlayerbutton=uicontrol(...
'Parent',hfig,...
'Style','pushbutton',...
'String',' ',...
'Fontsize',10,...
'Units','normalized',...
'Position',[.4 .82 .1 .06],...
'Callback',@layer);
function layer(hObj,evdt,handles)
%信息流线
uicontrol(...
'Parent',hfig,...
'Style','text',...
'Units','normalized',...
'Backgroundcolor',[0 0 0],...
'String',' ',...
'Position',[0.45 0.8 0.003 0.025]);
uicontrol(...
'Parent',hfig,...
'Style','text',...
'Units','normalized',...
'String','请输入该指标名称:',...
'FontSize', 10,...
'Position',[.7 .9 .16 .02]);
hLayerName= uicontrol(...
'Parent',hfig,...
'Style','edit',...
'Units','normalized',...
'FontSize', 8,...
'String',' ',...
'Position',[.88 .9 .1 .03]);
uicontrol(...
'Parent',hfig,...
'Style','text',...
'Units','normalized',...
'String','请输入下层子标个数:',...
'FontSize', 10,...
'Position',[.7 .87 .15 .02 ]);
hLayerNum= uicontrol(...
'Parent',hfig,...
'Style','edit',...
'Units','normalized',...
'FontSize', 8,...
'String',' ',...
'Position',[.88 .86 .06 .03]);
hlaylerInforButton1=uicontrol(...
'Parent',hfig,...
'Units','normalized',...
'Style','pushbutton',...
'String','确定',...
'Position',[.9 .8 .06 .03],...
'Callback',@laylerInforButton1);
function laylerInforButton1(hObj,evdt,handles)
A=get(hLayerNum,'String');
a=str2num(A);
%指标控件的大小设置
totalhedit = 0.06;
totalwedit =0.8/a;
hedit=2/3*totalhedit;
wedit=3/5*totalwedit;
ud.text2 =uicontrol(...
'Parent',gcbf,...
'Style','text',...
'Units','normalized',...
'Backgroundcolor',[0 0 0],...
'String',' ',...
'Position',[0.1+1/2*wedit 0.73+hedit+0.03 0.8-totalwedit+0.0001 0.003]);
%第二层控件的位置设置
for i=1:a
bx=(i-1)*totalwedit+0.1;
by=0.73;
pushbutton(i)= uicontrol(...
'Parent',gcbf,...
'Style','pushbutton',...
'String',' ',...
'units','normalized',...
'Position',[bx by wedit hedit],...
'Callback',{@layern,i});
%信息流线
uicontrol(...
'Parent',gcbf,...
'Style','text',...
'Units','normalized',...
'Backgroundcolor',[0 0 0],...
'String',' ',...
'Position',[bx+1/2*wedit by+hedit 0.003 0.03]);
end
str1=get(hLayerName,'string');
set( hlayerbutton,'String',str1);
end
end
end
function layern(hObj,evdt,handles)
end