Files
matlab-learning/C11_11_3.m
2025-11-03 11:24:09 +08:00

24 lines
1.4 KiB
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.5*H],'Name','图形演示系统','NumberTitle','off','MenuBar','none');
hplot=uimenu(gcf,'text','&Plot');
uimenu(hplot,'text','Sine Wave','Callback',...
['t=-pi:pi/20:pi;','plot(t,sin(t));'...
'set(hgon,''Enable'',''on'');','set(hgoff,''Enable'',''on'');'...
'set(hbon,''Enable'',''on'');','set(hboff,''Enable'',''off'');']);
uimenu(hplot,'text','Cosine Wave','Callback',...
['t=-pi:pi/20:pi;','plot(t,cos(t));'...
'set(hgon,''Enable'',''on'');','set(hgoff,''Enable'',''on'');'...
'set(hbon,''Enable'',''on'');','set(hboff,''Enable'',''off'');']);
% option
hoption=uimenu(gcf,'text','&Option');
hgon=uimenu(hoption,'text','&Grid on','Callback','grid on','Enable','off');
hgoff=uimenu(hoption,'text','&Grid off','Callback','grid off','Enable','off');
hbon=uimenu(hoption,'text','&Box on','Callback','box on','Enable','off');
hboff=uimenu(hoption,'text','&Box off','Callback','box off','Enable','off');
hwincor=uimenu(hoption,'text','&Window Color','Separator','on');
uimenu(hwincor,'text','&Red','Accelerator','r','Callback','set(gcf,''color'',''R'')');
uimenu(hwincor,'text','&Blue','Accelerator','b','Callback','set(gcf,''color'',''b'')');
uimenu(hwincor,'text','&Yellow','Accelerator','y','Callback','set(gcf,''color'',''y'')');
uimenu(hwincor,'text','&White','Accelerator','w','Callback','set(gcf,''color'',''w'')');