马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
帮帮帮==>救教!建立“图形演示系统”菜单。<==
题:建立下图所示“图形演示系统”菜单。菜单条中含有3个菜单项:Plot,Option和Quit。Plot中有一个“P控制图”子菜单项
,点击后会在坐标中出现P控制图图象。其中Grid on和Grid off控制坐标的网格线,Box on和Box off控制给坐标轴加边框,而
这四个选项只有在画有曲线是才是可选的。Figure Color控制图形窗口背景颜色。Quit控制退相互系统。
成功后的大体图形见下(不要笑啊,我用画图程序画的)
图片联接:
大体程序我已编好了,可就是出不来界面。程序如下:
screen=get(0,'ScreenSize');
W=screen(3);H=screen(4);
figure('Color',[1,1,1],'Position',[0.2*H,0.2*H,0.6*W,0.4*H],...
'Name','不合格品率P控制图演示系统','NumberTitle','off','MenuBar','none');
%定义Plot菜单项
hplot=uimenu(gcf,'Label','&Plot');
uimenu(hplot,'Label','Sine Wave','Call',[这里要插入我的P控制图实现程序,...
'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');
hfigcor=uimenu(hoption,'Label','&Figure Color','separator','on');
uimenu(hfigcor,'Label','&Red','Accelerator','r','Call','set(gcf,"Color","r");');
uimenu(hfigcor,'Label','&Blue','Accelerator','b','Call','set(gcf,"Color","b");');
uimenu(hfigcor,'Label','&Yellow','Call','set(gcf,"Color","y");');
uimenu(hfigcor,'Label','&White','Call','set(gcf,"Color","w");');
%定义Quit菜单项
uimenu(gcf,'Label','&Quit','Call','colse(gcf)');
我的P控制图程序:
x=[
1 240 22 0.092
2 240 8 0.033
3 240 14 0.058
4 240 10 0.042
5 240 11 0.046
6 240 11 0.046
7 240 10 0.042
8 240 18 0.075
9 240 13 0.054
10 240 16 0.066
11 240 18 0.075
12 240 12 0.050
13 240 10 0.042
14 240 12 0.050
15 240 8 0.033
16 240 5 0.021
17 240 10 0.042
18 240 10 0.042
19 240 6 0.025
20 240 7 0.029
21 240 6 0.025
22 240 10 0.042
23 240 9 0.038
24 240 13 0.054
25 240 4 0.017
26 240 6 0.025
27 240 4 0.017
28 240 7 0.029
29 240 5 0.021
30 240 3 0.013
];
y=[0 30];
z=[1 1];
plot(x(:,1),100*x(:,4),'k-*',y,4.1*z,'r:',y,7.94*z,'b:',y,0.26*z,'b:');
text(16,8.2,'上控制线 UCL 7.94');
text(16,4.6,'中心线 CL 4.1');
text(16,0.6,'下控制线 LCL 0.26');
xlabel('批号');
ylabel('p×100'); |