请大家看看为何有这样的错误提示(谢谢)
原程序如下:clear;
=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',);
%创建复选框
H2=uicontrol('String','渲染','Style','checkbox','Position',);
%创建复选框
H3=uicontrol('String','光照','Style','checkbox','Position',);
%创建复选框
H4=uicontrol('String','亮度','Style','checkbox','Position',);
%创建复选框
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,)');
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,:));')
%定义“亮度”复选框的事件
错误提示如下:
??? Error: Missing variable or function.
??? Error while evaluating uicontrol Callback.
请高手看看这是为什么。。 原帖由 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;
=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',);
%创建复选框
H2=uicontrol('String','渲染','Style','checkbox','Position',);
%创建复选框
H3=uicontrol('String','光照','Style','checkbox','Position',);
%创建复选框
H4=uicontrol('String','亮度','Style','checkbox','Position',);
%创建复选框
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,)');
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,:));')
%定义“亮度”复选框的事件 Happy教授厉害.
不过好像程序运行时,"光照"时还是不对,出现提示:
Warning: size(CData) must equal size(ZData) for interpolated shading.
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading.
[ 本帖最后由 xjzuo 于 2006-11-11 16:01 编辑 ]
页:
[1]