This commit is contained in:
2025-10-24 11:42:36 +08:00
parent 513e92c60c
commit 3907fdf5b1
7 changed files with 38 additions and 0 deletions

4
kongjian1.m Normal file
View File

@@ -0,0 +1,4 @@
pbstart=uicontrol(gcf,"Style","pushbutton","Position",[50,5,60,25],"String","Start Plot","Callback",...
"t=-pi:pi/20:2*pi;plot(t,sin(t))");
ptgrid=uicontrol(gcf,"Style","togglebutton","Position",[150,5,60,25],...
"String","Grid","Callback",'grid');

9
kongjian2.m Normal file
View File

@@ -0,0 +1,9 @@
set(gcf,'Color','R');
htext=uicontrol(gcf,"Style","text","String","Color Option","Position",[200,130,150,20]);
%
hr=uicontrol(gcf,"Style","radiobutton","String","Red","Position",[200,100,150,25],"Value",1,...
"Callback",['set(hr,''Value'',1);','set(hb,''Value'',0);','set(hy,''Value'',0);','set(gcf,''Color'',''R'')']);
hb=uicontrol(gcf,"Style","radiobutton","String","Blue","Position",[200,75,150,25],"Value",0,...
"Callback",['set(hr,''Value'',0);','set(hb,''Value'',1);','set(hy,''Value'',0);','set(gcf,''Color'',''B'')']);
hy=uicontrol(gcf,"Style","radiobutton","String","Yellow","Position",[200,50,150,25],"Value",0,...
"Callback",['set(hy,''Value'',0);','set(hb,''Value'',0);','set(hy,''Value'',1);','set(gcf,''Color'',''Y'')']);

11
kongjian3.m Normal file
View File

@@ -0,0 +1,11 @@
htxt=uicontrol(gcf,"Style","text","Position",[200,125,150,25],"String","Set Window Properties");
hp=uicontrol(gcf,"Style","checkbox","Position",[200,100,150,25],"String","My Position",...
"Callback",["set(gcf,""Position"",[10,10,300,250];",...
"if get(hp,""Value"")==1,",...
"set(gcf,""Position"",[10,10,600,500]),",'end']);
hc=uicontrol(gcf,"Style","checkbox","Position",[200,75,150,25],"String","My Color",...
"Callback",["set(gcf,""color"",""w"");","if get(hc,""Value"")==1,","set(gcf,""color"",g]","end"]);
hn=uicontrol(gcf,"Style","checkbox","Position",[200,50,150,25],"String","My Name",...
"Callback",["set(gcf,""Name"",""未选择"";",...
"if get(hn,""Value"")==1,",...
"set(gcf,""Name"",""未选择"")","end");

2
kongjian4.m Normal file
View File

@@ -0,0 +1,2 @@
hpop=uicontrol(gcf,"Style","popup","String",'red|blue|green|yellow|white','Position',[100,100,100,80],...
'Callback',['cbcol=[''R'',''B'',''G'',''Y''];','set(gcf,''Color'',cbcol(get(hpop,''Value'')))']);

4
kongjian5.m Normal file
View File

@@ -0,0 +1,4 @@
h1=uicontrol(gcf,'Style','listbox','String','red|blue|green|yellow|white',...
'Position',[100,100,100,80],'Callback',...
['cbcol=[''r'',''b'',''g'',''y'',''w''];',...
'set(gcf,''color'',cbcol(get(h1,''Value'')))']);

3
kongjian6.m Normal file
View File

@@ -0,0 +1,3 @@
ftdir=uicontrol(gcf,'Style','frame','BackgroundColor','y','Position',[30,180,120,100]);
edmulti=uicontrol(gcf,'Style','edit','String','Matlab is a very useful Language',...
'Position',[50,200,75,55],'Max',2,'BackgroundColor','w');

5
kongjian7.m Normal file
View File

@@ -0,0 +1,5 @@
fig=figure('Position',[20,20,400,150]);
hsli1=uicontrol(fig,'Style','slider','Position',[50,50,120,20],'Min',200,'Max',800,'Value',400,...
'Callback',['set(azmcur,''String'','...
'num2str(get(hsli1,''Value'')));'...
'set(gcf,''Position'',[20,20,get(hsli1,''Value''),300]);']);