马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
%main.m<BR>clf reset<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,'defaultucontrolhorizontal','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','position',[0.52,0.87,0.26,0.1],'String','绘图指令框');<BR>hedit=uicontrol(gcf,'Style','edit','position',[0.52,0.05,0.26,0.8],'Max',2);<BR>hpop=uicontrol(gcf,'style','popup','position',[0.8,0.73,0.18,0.12],'string','spring|summer|autumn|winter');<BR>hlist=uicontrol(gcf,'style','list','position',[0.8,0.23,0.18,0.37],'sring','Grid on|Box on|Hidden off|Axis off','Max',2);<BR>hpush=uicontrol(gcf,'style','push','position',[0.8,0.05,0.18,0.15],'string','Apply');<BR>set(hedit,'callback','calledit(hedit,hpop,hlist)');<BR>set(hpop,'callback','calledit(hedit,hpop,hlist)');<BR>set(hpush,'callback','calledit(hedit,hpop,hlist)');<BR>%calledit.m<BR>function calledit(hedit,hpop,hlist)<BR>ct=get(hedit,'string');<BR>vpop=get(hpop,'value');<BR>vlist=get(hlist,'value');<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<BR><BR>怎么老是出现?? Error: File: C:\MATLAB6p5\work\huitushuru.m Line: 20 Column: 1<BR>A function declaration cannot appear within a script M-file.<BR><BR>还有在问问。。如何能在菜单栏里弄上个动画的选项?<BR> |