From 3907fdf5b19258b9b41d021225661e3c57368c26 Mon Sep 17 00:00:00 2001 From: bisnsh Date: Fri, 24 Oct 2025 11:42:36 +0800 Subject: [PATCH] 251024 --- kongjian1.m | 4 ++++ kongjian2.m | 9 +++++++++ kongjian3.m | 11 +++++++++++ kongjian4.m | 2 ++ kongjian5.m | 4 ++++ kongjian6.m | 3 +++ kongjian7.m | 5 +++++ 7 files changed, 38 insertions(+) create mode 100644 kongjian1.m create mode 100644 kongjian2.m create mode 100644 kongjian3.m create mode 100644 kongjian4.m create mode 100644 kongjian5.m create mode 100644 kongjian6.m create mode 100644 kongjian7.m diff --git a/kongjian1.m b/kongjian1.m new file mode 100644 index 0000000..b148ed6 --- /dev/null +++ b/kongjian1.m @@ -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'); \ No newline at end of file diff --git a/kongjian2.m b/kongjian2.m new file mode 100644 index 0000000..4048a5c --- /dev/null +++ b/kongjian2.m @@ -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'')']); diff --git a/kongjian3.m b/kongjian3.m new file mode 100644 index 0000000..f7e09bf --- /dev/null +++ b/kongjian3.m @@ -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"); \ No newline at end of file diff --git a/kongjian4.m b/kongjian4.m new file mode 100644 index 0000000..58131e9 --- /dev/null +++ b/kongjian4.m @@ -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'')))']); \ No newline at end of file diff --git a/kongjian5.m b/kongjian5.m new file mode 100644 index 0000000..8eea49e --- /dev/null +++ b/kongjian5.m @@ -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'')))']); \ No newline at end of file diff --git a/kongjian6.m b/kongjian6.m new file mode 100644 index 0000000..312ae45 --- /dev/null +++ b/kongjian6.m @@ -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'); \ No newline at end of file diff --git a/kongjian7.m b/kongjian7.m new file mode 100644 index 0000000..651cb33 --- /dev/null +++ b/kongjian7.m @@ -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]);']); \ No newline at end of file