%觉得有很多不足的地方,其中就是点了运算符号之后,就开始做运算了,希望能解决,本人时间没有了。要找工作了
h0=figure('toolbar','none',...
'menu','none',...%设置取消菜单
'color',[0.4,0.8,0.95],... %设置主框架颜色
'position',[403.8 320.923 320 320],... %设置位置和面积大小
'Name',' 广工汉化版计器器——GXUT', ...%设置名字
'NumberTitle','off', 'HandleVisibility', 'on', ...%设置名字是否需要符号
'Visible','on', 'Resize', 'off',... %设置可见性和可收缩性
'Colormap', gray(256));%设置颜色范围
%加号
b11=uicontrol('parent',h0,...
'units','points',...
'tag','b11',...
'style','pushbutton',...
'string','加',...
'fontsize',12,...
'position',[125 15 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'i=i+1;,',...
'if i==1,',...
'm=str2num(k);,',...
'set(e1,''string'',''0'');,',...
'end,',...
'if i>1,',...
'k=get(e1,''string'');,',...
'if g==''+'',',...
'm=m+str2num(k);,',...
'end,',...
'if g==''-'',',...
'm=m-str2num(k);,',...
'end,',...
'if g==''*'',',...
'm=m*str2num(k);,',...
'end,',...
'if g==''/'',',...
'if k==''0'',',...
'errordlg(''除数不能为0'');,',...
'end,',...
'm=m/str2num(k);,',...
'end,',...
'set(e1,''string'',num2str(m));,',...
'i=1;,',...
'end,',...
'k=''0'';,',...
'g=''+'';']);
%减号
b12=uicontrol('parent',h0,...
'units','points',...
'tag','b12',...
'style','pushbutton',...
'string','减',...
'fontsize',12,...
'position',[165 105 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'i=i+1;,',...
'if i==1,',...
'm=str2num(k);,',...
'set(e1,''string'',''0'');,',...
'end,',...
'if i>1,',...
'k=get(e1,''string'');,',...
'if g==''+'',',...
'm=m+str2num(k);,',...
'end,',...
'if g==''-'',',...
'm=m-str2num(k);,',...
'end,',...
'if g==''*'',',...
'm=m*str2num(k);,',...
'end,',...
'if g==''/'',',...
'if k==''0'',',...
'errordlg(''除数不能为0'');,',...
'end,',...
'm=m/str2num(k);,',...
'end,',...
'set(e1,''string'',num2str(m));,',...
'i=1;,',...
'end,',...
'k=''0'';,',...
'g=''-'';']);
%乘号
b13=uicontrol('parent',h0,...
'units','points',...
'tag','b13',...
'style','pushbutton',...
'string','乘',...
'fontsize',12,...
'position',[165 75 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'i=i+1;,',...
'if i==1,',...
'm=str2num(k);,',...
'set(e1,''string'',''0'');,',...
'end,',...
'if i>1,',...
'k=get(e1,''string'');,',...
'if g==''+'',',...
'm=m+str2num(k);,',...
'end,',...
'if g==''-'',',...
'm=m-str2num(k);,',...
'end,',...
'if g==''*'',',...
'm=m*str2num(k);,',...
'end,',...
'if g==''/'',',...
'if k==''0'',',...
'errordlg(''除数不能为0'');,',...
'end,',...
'm=m/str2num(k);,',...
'end,',...
'set(e1,''string'',num2str(m));,',...
'i=1;,',...
'end,',...
'k=''0'';,',...
'g=''*'';']);
%除号
b14=uicontrol('parent',h0,...
'units','points',...
'tag','b14',...
'style','pushbutton',...
'string','除',...
'fontsize',12,...
'position',[165 45 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'i=i+1;,',...
'if i==1,',...
'm=str2num(k);,',...
'set(e1,''string'',''0'');,',...
'end,',...
'if i>1,',...
'k=get(e1,''string'');,',...
'if k==''0'',',...
'errordlg(''除数不能为0'');,',...
'end,',...
'if ~(k==''0''),',...
'if g==''+'',',...
'm=m+str2num(k);,',...
'end,',...
'if g==''-'',',...
'm=m-str2num(k);,',...
'end,',...
'if g==''*'',',...
'm=m*str2num(k);,',...
'end,',...
'if g==''/'',',...
'm=m/str2num(k);,',...
'end,',...
'set(e1,''string'',num2str(m));,',...
'end,',...
'i=1;,',...
'end,',...
'k=''0'';,',...
'g=''/'';']);
%等号
b15=uicontrol('parent',h0,...
'units','points',...
'tag','b15',...
'style','pushbutton',...
'string','=',...
'fontsize',12,...
'position',[85 15 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'k=get(e1,''string'');,',...
'if g==''+'',',...
'm=m+str2num(k);,',...
'end,',...
'if g==''-'',',...
'm=m-str2num(k);,',...
'end,',...
'if g==''*'',',...
'm=m*str2num(k);,',...
'end,',...
'if g==''/'',',...
'if k==''0'',',...
'errordlg(''除数不能为0'');,',...
'end,',...
'm=m/str2num(k);,',...
'end,',...
'set(e1,''string'',num2str(m));,',...
'i=0;']);
b0=uicontrol('parent',h0,...
'units','points',...
'tag','b0',...
'style','pushbutton',...
'string','0',...
'fontsize',12,...
'position',[45 15 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'if k==''0''&i==0,',...
'errordlg(''数字首位不能为0''),',...
'else,',...
'k=[k,''0''];,',...
'if k==''00'',',...
'k=''0'';,',...
'end,',...
'set(e1,''string'',k);,',...
'end']);
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','1',...
'fontsize',12,...
'position',[45 45 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'if k==''0'',',...
'k='''';,',...
'end,',...
'k=[k,''1''];,',...
'set(e1,''string'',k);']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','2',...
'fontsize',12,...
'position',[85 45 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'if k==''0'',',...
'k='''';,',...
'end,',...
'k=[k,''2''];,',...
'set(e1,''string'',k);']);
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'style','pushbutton',...
'string','3',...
'fontsize',12,...
'position',[125 45 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'if k==''0'',',...
'k='''';,',...
'end,',...
'k=[k,''3''];,',...
'set(e1,''string'',k);']);
b4=uicontrol('parent',h0,...
'units','points',...
'tag','b4',...
'style','pushbutton',...
'string','4',...
'fontsize',12,...
'position',[45 75 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'if k==''0'',',...
'k='''';,',...
'end,',...
'k=[k,''4''];,',...
'set(e1,''string'',k);']);
b5=uicontrol('parent',h0,...
'units','points',...
'tag','b5',...
'style','pushbutton',...
'string','5',...
'fontsize',12,...
'position',[85 75 35 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'callback',[...
'if k==''0'',',...
'k='''';,',...
'end,',...
'k=[k,''5''];,',...
'set(e1,''string'',k);']);
b6=uicontrol('parent',h0,...
'units','points',...
'tag','b6',...
'style','pushbutton',...
'string','6',...
'fontsize',12,...
'position',[1