⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exm10053_2.m

📁 matlab mfiles实例分析
💻 M
字号:
function exm10053_2(flag)
if nargin<1;flag='startup';end		%		<2>
if ~ischar(flag);error('flag must be character ''startup''.');end
switch flag							%									<4>
case 'startup'											%						<5>
clf reset													%						<6>	
set(gcf,'unit','normalized','position',[0.1,0.4,0.85,0.35]);
set(gcf,'defaultuicontrolunits','normalized');
set(gcf,'defaultuicontrolfontsize',11);
set(gcf,'defaultuicontrolfontname','隶书');
set(gcf,'defaultuicontrolhorizontal','left');
set(gcf,'menubar','none');								%
str='通过多行指令绘图的交互界面';
set(gcf,'name',str,'numbertitle','off');				%
h_axes=axes('position',[0.05,0.15,0.45,0.70],'visible','off');  
uicontrol(gcf,'Style','text',...						%
   'position',[0.52,0.87,0.26,0.1],...
   'String','绘图指令输入框');
hedit=uicontrol(gcf,'Style','edit',...				%		<19>
   'position',[0.52,0.05,0.26,0.8],...								%		<20>
   'Tag','H_edit',...
   'Max',2);							%		<21>
hpop=uicontrol(gcf,'style','popup',...				%			<22>
   'position',[0.8,0.73,0.18,0.12],...								%		<23>
   'Tag','H_popup',...
   'string','spring|summer|autumn|winter');%			<24>
hlist=uicontrol(gcf,'Style','list',...				%		<25>
   'position',[0.8,0.23,0.18,0.37],...								%		<26>
   'string','Grid on|Box on|Hidden off|Axis off',...%	<27>
   'Tag','H_list',...
   'Max',2);							%		<28>
hpush=uicontrol(gcf,'Style','push',...	%			<29>
   'position',[0.8,0.05,0.18,0.15],'string','Apply');
set(hedit,'callback','exm10053_2(''set'')');			%	<31>
set(hpop,'callback','exm10053_2(''set'')');			%	<32>
set(hpush,'callback','exm10053_2(''set'')');			%		<33>
case 'set'								%							<35>
H(1)=findobj(gcf,'Tag','H_edit');
H(2)=findobj(gcf,'Tag','H_popup');
H(3)=findobj(gcf,'Tag','H_list');
ct=get(H(1),'string');				%					<37>
vpop=get(H(2),'value');				%						<38>
vlist=get(H(3),'value');			%							<39>
if ~isempty(ct)						
   eval(ct')							%	
   popstr={'spring','summer','autumn','winter'};		%
   liststr={'grid on','box on','hidden off','axis off'};%	
   invstr={'grid off','box off','hidden on','axis on'};%
   colormap(eval(popstr{vpop}))		%
   vv=zeros(1,4);vv(vlist)=1;		
   for k=1:4
      if vv(k);eval(liststr{k});else eval(invstr{k});end %
   end
end   																			%	<50>
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -