求助:帮忙解释一下每条语句
小弟刚刚开始学习matlab,找到一个源程序看不太明白,希望那位大哥帮忙解释一下,小弟在此不胜感激……源代码如下:
screen=get(0,'ScreenSize');
W=screen(3);H=screen(4);
figure('Color',,'Position',,...
'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)'); 很简单,你把它在matlab环境下一运行,就知道总体意思,在分语句调试即可,这段程序用到了一些图形句柄的知识,可以看一下相关书籍!
页:
[1]