原帖由 cuizhichao 于 2006-11-7 20:45 发表
原程序如下:
clear;
=meshgrid(,);
R=sqrt(X.^2+Y.^2)+eps;
Z=sin(R)./R;
h2=surf(X,Y,Z);
%绘制阔边帽
H1=uicontrol('String','染色','Style','checkbox','Position',);
%创建复选框
H2=uicontrol('St ...
注意,value是两个单引号,而不是双引号,正确定的程序如下:
- clear;
- [X,Y]=meshgrid([-10:0.4:10],[-10:0.4:10]);
- R=sqrt(X.^2+Y.^2)+eps;
- Z=sin(R)./R;
- h2=surf(X,Y,Z);
- %绘制阔边帽
- H1=uicontrol('String','染色','Style','checkbox','Position',[470 280 60 30]);
- %创建复选框
- H2=uicontrol('String','渲染','Style','checkbox','Position',[470 240 60 30]);
- %创建复选框
- H3=uicontrol('String','光照','Style','checkbox','Position',[470 200 60 30]);
- %创建复选框
- H4=uicontrol('String','亮度','Style','checkbox','Position',[470 160 60 30]);
- %创建复选框
- cmp=str2mat('colormap default','colormap hot');
- set(H1,'CallBack','v1=get(H1,''value'');eval(cmp(v1+1,:));')
- %定义“染色”复选框的事件
- sha=str2mat('shading faceted','shading interp');
- set(H2,'CallBack','v2=get(H2,''value'');eval(sha(v2+1,:));')
- %定义“渲染”复选框的事件
- sur=str2mat('surf(X,Y,Z)','surf(X,Y,Z,[30 45])');
- set(H3,'CallBack','v3=get(H3,''value'');eval(sur(v3+1,:)),eval(sha(v2+1,:));')
- %定义“光照”复选框的事件
- bgt=str2mat('brighten(-0.5)','brighten(0.5)');
- set(H4,'CallBack','v4=get(H4,''value'');eval(bgt(v4+1,:));')
- %定义“亮度”复选框的事件
复制代码 |