<P>能帮我把这个程序弄成可以在未装MATLAB机器上独立执行吗?<BR>最好能把搞的过程也说说。。便于我们这些鸟儿理解。。。<BR><BR>function exm1153_1(flag) <BR>if nargin<1;flag='startup';end %允许在无输入宗量形式下调用该函数 <2> <BR>if ~ischar(flag);error('flag must be character ''startup''.');end <BR>switch flag %切换控制 <4> <BR>case 'startup' % <5> <BR>clf reset % <6> <BR>set(gcf,'unit','normalized','position',[0.1,0.4,0.85,0.35]); <BR>set(gcf,'defaultuicontrolunits','normalized'); <BR>set(gcf,'defaultuicontrolfontsize',11); <BR>set(gcf,'defaultuicontrolfontname','隶书'); <BR>set(gcf,'defaultuicontrolhorizontal','left'); <BR>set(gcf,'menubar','none'); %删除图形窗工具条 <BR>str='通过多行指令绘图的交互界面'; <BR>set(gcf,'name',str,'numbertitle','off'); %书写图形窗名 <BR>h_axes=axes('position',[0.05,0.15,0.45,0.70],'visible','off'); <BR>uicontrol(gcf,'Style','text',... %制作静态文本框 <BR>'position',[0.52,0.87,0.26,0.1],... <BR>'String','绘图指令输入框'); <BR>hedit=uicontrol(gcf,'Style','edit',... %制作可编辑文本框 <19> <BR>'position',[0.52,0.05,0.26,0.8],... % <20> <BR>'Max',2); %取2,使Max-Min>1,而允许多行输入 <21> <BR>hpop=uicontrol(gcf,'style','popup',... %制作弹出菜单 <22> <BR>'position',[0.8,0.73,0.18,0.12],... % <23> <BR>'string','spring|summer|autumn|winter');%设置弹出框中选项名 <24> <BR>hlist=uicontrol(gcf,'Style','list',... %制作列表框 <25> <BR>'position',[0.8,0.23,0.18,0.37],... % <26> <BR>'string','Grid on|Box on|Hidden off|Axis off',...%设置列表框中选项名 <27> <BR>'Max',2); %取2,使Max-Min>1,而允许多项选择 <28> <BR>hpush=uicontrol(gcf,'Style','push',... %制作与列表框配用的按键 <29> <BR>'position',[0.8,0.05,0.18,0.15],'string','Apply'); <BR>set(hedit,'callback','exm1153_1(''set'')'); %编辑框输入引起回调 <31> <BR>set(hpop,'callback','exm1153_1(''set'')'); %弹出框选择引起回调 <32> <BR>set(hpush,'callback','exm1153_1(''set'')'); %按键引起的回调 <33> <BR>set(gcf,'UserData',[hedit,hpop,hlist]); %向'UserData'存放图柄 <34> <BR>case 'set' %以下是回调函数 <35> <BR>H=get(gcf,'UserData'); %从'UserData'获取图柄 <36> <BR>ct=get(H(1),'string'); %获得输入的字符串函数 <37> <BR>vpop=get(H(2),'value'); %获得选项的位置标识 <38> <BR>vlist=get(H(3),'value'); %获得选项位置向量 <39> <BR>if ~isempty(ct) ;<BR>eval(ct');%运行从编辑文本框送入的指令 <BR>popstr={'spring','summer','autumn','winter'}; %弹出框色图矩阵 <BR>liststr={'grid on','box on','hidden off','axis off'};%列表框选项内容 <BR>invstr={'grid off','box off','hidden on','axis on'};%列表框的逆指令 <BR>colormap(eval(popstr{vpop})) %采用弹出框所选色图 <BR>vv=zeros(1,4);vv(vlist)=1; <BR>for k=1:4 <BR>if vv(k);eval(liststr{k});else eval(invstr{k});end %按列表选项影响图形 <BR>end <BR>end % <50> <BR>end <BR><BR>似乎长了点。。</P> |