|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
小弟刚刚开始学习matlab,找到一个源程序看不太明白,希望那位大哥帮忙解释一下,小弟在此不胜感激……
源代码如下:
screen=get(0,'ScreenSize');
W=screen(3);H=screen(4);
figure('Color',[1,1,1],'Position',[0.2*H,0.2*H,0.5*W,0.3*H],...
'Name','图形演示系统','NumberTitle','off','MenuBar','none');
%定义Plot菜单项
hplot=uimenu(gcf,'Label','&Plot');
uimenu(hplot,'Label','Sine Wave','Call',...
['t=-pi:pi/20:pi;','plot(t,sin(t));',...
'set(hgon,''Enable'',''on'');',...
'set(hgoff,''Enable'',''on'');',...
'set(hbon,''Enable'',''on'');',...
'set(hboff,''Enable'',''on'');']);
uimenu(hplot,'Label','Cosine Wave','Call',...
['t=-pi:pi/20:pi;','plot(t,cos(t));',...
'set(hgon,''Enable'',''on'');',...
'set(hgoff,''Enable'',''on'');',...
'set(hbon,''Enable'',''on'');',...
'set(hboff,''Enable'',''on'');']);
%定义Option菜单项
hoption=uimenu(gcf,'Label','&Option');
hgon=uimenu(hoption,'Label','&Grig on',...
'Call','grid on','Enable','off');
hgoff=uimenu(hoption,'Label','&Grig off',...
'Call','grid off','Enable','off');
hbon=uimenu(hoption,'Label','&Box on',...
'separator','on','Call','box on','Enable','off');
hboff=uimenu(hoption,'Label','&Box off',...
'Call','box off','Enable','off');
hwincor=uimenu(hoption,'Label','&Window Color','Separator','on');
uimenu(hwincor,'Label','&Red','Accelerator','r',...
'Call','set(gcf,''Color'',''r'');');
uimenu(hwincor,'Label','&Blue','Accelerator','b',...
'Call','set(gcf,''Color'',''b'');');
uimenu(hwincor,'Label','&Yellow','Call',...
'set(gcf,''Color'',''y'');');
uimenu(hwincor,'Label','&White','Call',...
'set(gcf,''Color'',''w'');');
%定义Quit菜单项
uimenu(gcf,'Label','&Quit','Call','close(gcf)'); |
|