usin 发表于 2005-11-15 20:05

[求助]帮帮帮==>救教 !建立“图形演示系统”菜单。

帮帮帮==>救教!建立“图形演示系统”菜单。<==

题:建立下图所示“图形演示系统”菜单。菜单条中含有3个菜单项:Plot,Option和Quit。Plot中有一个“P控制图”子菜单项

,点击后会在坐标中出现P控制图图象。其中Grid on和Grid off控制坐标的网格线,Box on和Box off控制给坐标轴加边框,而

这四个选项只有在画有曲线是才是可选的。Figure Color控制图形窗口背景颜色。Quit控制退相互系统。

成功后的大体图形见下(不要笑啊,我用画图程序画的)

图片联接:http://pconline.tengyi.cn/tp.jpg

大体程序我已编好了,可就是出不来界面。程序如下:

screen=get(0,'ScreenSize');
W=screen(3);H=screen(4);
figure('Color',,'Position',,...
'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=;
z=;
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');

happy 发表于 2005-11-15 21:04

附件在哪儿?

usin 发表于 2005-11-15 22:29

我上传是总显示“错误:请不要重复提交!”
不过“两个程序文件”上面都有了!
事例图片见吧!

VibInfo 发表于 2005-11-16 00:19

关于附件上传请见帖子
http://forum.vibunion.com/thread-4648-1-1.html

MVH 发表于 2005-11-16 10:12

uimenu(hplot,'Label','Sine Wave','Call',[这里要插入我的P控制图实现程序,...
'set(hgon,"Enable","on");','set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");','set(hboff,"Enable","on");']);
%定义Option菜单项

这个不给出来程序运行不下去,没法调啊
或者你把错误提示贴出来吧

glise 发表于 2005-11-16 10:52

我试了一下,界面可以出来,但是菜单不可用

注:去掉这一句运行的
uimenu(hplot,'Label','Sine Wave','Call',[这里要插入我的P控制图实现程序,...
'set(hgon,"Enable","on");','set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");','set(hboff,"Enable","on");']);

usin 发表于 2005-11-16 11:03

这一句:
uimenu(hplot,'Label','Sine Wave','Call',[这里要插入我的P控制图实现程序,...
'set(hgon,"Enable","on");','set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");','set(hboff,"Enable","on");']);

我把=>
'set(hgon,"Enable","on");','set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");','set(hboff,"Enable","on");']);
去掉就好了,是不是set(...)出了问题?

改为这样是行的通的:
uimenu(hplot,'Label','Sine Wave','Call','p_kzt');

这里的p_kzt是我提供的M文件!

suffer 发表于 2005-11-16 13:21

引号用错了,是两个单引号,不是双引号

usin 发表于 2005-11-16 19:55

谢了!

usin 发表于 2005-11-16 19:57

谢了!
页: [1]
查看完整版本: [求助]帮帮帮==>救教 !建立“图形演示系统”菜单。