如何清除文本框的内容??
求助!!编一个M 文件 有一个可编辑的文本框
想设一个按钮可以清除已经输入文本框的内容!?? 假设按钮的tag为pushbutton1,编辑框的tag为edit1
则按钮的回电函数:
function pushbutton1_Callback(hObject, eventdata, handles)
set(handles.edit1,'string',' ');
可实现清除已经输入文本框的内容。 不行啊 我试了 报错!! set(gcf,'position',);
set(gcf,'menubar','none','name','sample','numbertitle','off');
hdraw=uimenu(gcf,'Label','&draw');
hmeshg=uimenu(hdraw,'Label','meshgrid','Call',...
['x=0:0.1:2*pi;','=meshgrid(x);','plot(x,y,"*")','grid on;',...
'view(3);']);
hmesh=uimenu(hdraw,'Label','mesh','Call','mesh(peaks);');
hsurf=uimenu(hdraw,'Label','surf','Call','surf(peaks);');
hcolormap=uimenu(gcf,'Label','&colormap');
hcool=uimenu(hcolormap,'Label','&cool','Call','colormap(cool);');
hhot=uimenu(hcolormap,'Label','&hot','Call','colormap(hot);');
hdefault=uimenu(hcolormap,'Label','&default','Call',...
'colormap(jet);');
uimenu(gcf,'Label','&exit','Call','close(gcf)');
hfaceted=uicontrol(gcf,'style','push','string','faceted','call',...
'shading faceted;','position',);
hfalt=uicontrol(gcf,'style','push','string','falt','call',...
'shading flat;','position',);
uicontrol(gcf,'style','push','string','interp','call',...
'shading interp;','position',);
hxd=uicontrol(gcf,'style','edit','position',);
hyd=uicontrol(gcf,'style','edit','position',);
view=['x=str2num(get(hxd,"string"));','y=str2num(get(hyd,"string"));',...
'view(x,y);'];
uicontrol(gcf,'style','text','string','x','position',);
uicontrol(gcf,'style','text','string','y','position',);
hview=uicontrol(gcf,'style','push','string','view','position',,...
'call',view);
hedit=uicontrol(gcf,'style','edit','position',);
hok=uicontrol(gcf,'style','push','string','OK','position',,...
'call',['t=get(hedit,"string";)','eval(t);']);
hclear=uicontrol(gcf,'style','push','string','clear','position',,...
'call','set(hedit,"string"," ");');
我编的的 各位大大看一下 把你里面的 "(双引号)全部给改成 ''(两个单引号)
再拿去试试,差不多就行了吧!你的错误应该是在这儿的 我的代码是在GUI工具下的m文件实现,并且
通过matlab 6.5的运行了, 呵呵 谢谢 问题解决了谢谢
今天又学了点!!
页:
[1]