【奠基经典】MATLAB实用程序案例之修改函数曲线图颜色的用户界面
修改函数曲线图颜色的用户界面
实例:
h0=figure('toolbar','none',...'position',,...'name','实例51');h1=axes('parent',h0,...'position',,...'visible','off');=meshgrid(-8:0.5:8);r=sqrt(x.^2+y.^2)+eps;z=sin(r)./r;f1=surf(x,y,z);shading interpview(-50,30)camlight leftcolormap()fv=get(h0,'colormap');ifv=fv;p1=uicontrol('parent',h0,...'style','pushbutton',...'string','重置',...'position',,...'callback',[...'set(s1,''value'',ifv(1));,',...'set(s2,''value'',ifv(2));,',...'set(s3,''value'',ifv(3));,',...'set(h0,''colormap'',ifv)']);p2=uicontrol('parent',h0,...'style','pushbutton',...'string','关闭',...
'position',,...
'callback','close');
s1=uicontrol('parent',h0,...
'style','slider',...
'min',0,...
'max',1,...
'value',fv(1),...
'position',,...
'callback',[...
's1k=get(s1,''value'');,',...
'fv(1)=s1k;,',...
'set(h0,''colormap'',fv);']);
t1=uicontrol('parent',h0,...
'style','text',...
'string','改变红色成分',...
'position',);
s2=uicontrol('parent',h0,...
'style','slider',...
'min',0,...
'max',1,...
'value',fv(2),...
'position',,...
'callback',[...
's2k=get(s2,''value'');,',...
'fv(2)=s2k;,',...
'set(h0,''colormap'',fv);']);
t2=uicontrol('parent',h0,...
'style','text',...
'string','改变绿色成分',...
'position',);
s3=uicontrol('parent',h0,...
'style','slider',...
'min',0,...
'max',1,...
'value',fv(3),...
'position',,...
'callback',[...
's3k=get(s3,''value'');,',...
'fv(3)=s3k;,',...
'set(h0,''colormap'',fv);']);
t1=uicontrol('parent',h0,...
'style','text',...
'string','改变蓝色成分',...
'position',);
关于本帖内容欢迎大家踊跃讨论,与在下交流!
页:
[1]