青年梦想家 发表于 2015-7-28 22:59

【奠基经典】MATLAB实用程序案例之除法计算器







除法计算器
实例:
h=figure('toolbar','none',...
'position',,...
'name','实例41');
h1=uicontrol(gcf,'style','edit',...
'position',,...
'HorizontalAlignment','right',...
'callback',['m=get(h1,''string'');,',...
'a=str2num(m);']);
h2=uicontrol(gcf,'style','edit',...
'HorizontalAlignment','right',...
'position',,...
'callback',['n=get(h2,''string'');,',...
'b=str2num(n);']);
h3=uicontrol(gcf,'style','text',...
'string','被除数',...
'position',);
h4=uicontrol(gcf,'style','edit',...
'position',);
h5=uicontrol(gcf,'style','pushbutton',...
'position',,...
'string','=',...
'callback',[...
'if b==0,',...
'h7=errordlg(''除数不能为0!'',''error'',''on'');,',...
'else,',...
'k=a/b;,',...
'c=num2str(k);,',...
'set(h4,''string'',c),',...
'end']);
h8=uicontrol(gcf,'style','text',...
'string','除数',...
'position',);
h9=uicontrol(gcf,'style','text',...
'string','商',...
'position',);

关于本帖内容欢迎大家踊跃讨论,与在下交流!



页: [1]
查看完整版本: 【奠基经典】MATLAB实用程序案例之除法计算器