cooldog123pp 发表于 2024-2-24 21:06

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 除法计算器