• 大小: 19KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2023-12-03
  • 语言: Matlab
  • 标签: matlab  gui  

资源简介

基于MATLAB GUI的多功能科学计算器

资源截图

代码片段和文件信息

m=figure(‘toolbar‘‘none‘...
    ‘position‘[500 200 300 380]...                  %计算器出现在屏幕中央
    ‘Numbertitle‘‘off‘...
    ‘name‘‘Hyo_caculator‘);
tmp=uimenu(‘Label‘‘&Info‘);                                     %增加了制作信息按扭
    uimenu(tmp‘Label‘‘Production &Infos‘‘Callback‘[‘msgbox({‘‘ Made By Hyo on Jan.9th 2009 ‘‘}‘‘Production info‘‘)‘]);
e=uicontrol(‘parent‘m...                           %显示器的设计
    ‘units‘‘points‘...                             
    ‘tag‘‘e‘...                                     %标签名称,可以被调用
    ‘style‘‘edit‘...
    ‘string‘‘0‘...
    ‘backgroundcolor‘[1 1 1]...                       %背景是白色
    ‘position‘[13 230 200 30]...
    ‘fontsize‘12...
    ‘horizontalalignment‘‘right‘);                    %水平右对齐
b0=uicontrol(‘parent‘m...
    ‘units‘‘points‘...
    ‘tag‘‘b0‘...
    ‘style‘‘pushbutton‘...                          
    ‘string‘‘0‘...
    ‘fontsize‘11...
    ‘position‘[20 20 30 20]...
    ‘backgroundcolor‘[1 1 1 ]...
    ‘callback‘[...
    ‘if k==‘‘0‘‘‘...                                      %如果输入前是0,那么将它除去免去产生一长串0的结果
        ‘k=‘‘‘‘;‘...
        ‘end‘...
        ‘k=[k‘‘0‘‘];‘...                                 %重要的是支持输入新的数后,原来的数字左移,引号内用引号要使用两个引号
        ‘set(e‘‘string‘‘k);‘]);
b1=uicontrol(‘parent‘m...
    ‘units‘‘points‘...
    ‘tag‘‘b1‘...
    ‘style‘‘pushbutton‘...
    ‘string‘‘1‘...
    ‘fontsize‘11...
    ‘position‘[60 20 30 20]...
    ‘backgroundcolor‘[1 1 1]...
    ‘callback‘[...
      ‘if k==‘‘0‘‘‘...
        ‘k=‘‘‘‘;‘...
        ‘end‘...
        ‘k=[k‘‘1‘‘];‘...                                 %重要的是支持输入新的数后,原来的数字左移
        ‘set(e‘‘string‘‘k);‘]);
b2=uicontrol(‘parent‘m...
    ‘units‘‘points‘...
    ‘tag‘‘b2‘...
    ‘style‘‘pushbutton‘...
    ‘string‘‘2‘...
    ‘fontsize‘11...
    ‘position‘[100 20 30 20]...
    ‘backgroundcolor‘[1 1 1]...
    ‘callback‘[...
   ‘if k==‘‘0‘‘‘...
        ‘k=‘‘‘‘;‘...
        ‘end‘...
        ‘k=[k‘‘2‘‘];‘...                                 %重要的是支持输入新的数后,原来的数字左移
        ‘set(e‘‘string‘‘k);‘]);
b3=uicontrol(‘parent‘m...
    ‘units‘‘points‘...
    ‘tag‘‘b3‘...
    ‘style‘‘pushbutton‘...
    ‘string‘‘3‘...
    ‘fontsize‘11...
    ‘position‘[140 20 30 20]...
    ‘backgroundcolor‘[1 1 1]...
    ‘callback‘[...
   ‘if k==‘‘0‘‘‘...                                      %如果输入前是0,那么将它除去
        ‘k=‘‘‘‘;‘...
        ‘end‘...
        ‘k=[k‘‘3‘‘];‘...                                 %重要的是支持输入新的数后,原来的数字左移
        ‘set(e‘‘string‘‘k);‘]);
b4=uicontrol(‘parent‘m...
    ‘units‘‘points‘...
    ‘tag‘‘b4‘...
    ‘style‘‘pushbutton‘...
    ‘string‘‘4‘...
    ‘fontsize‘11...
    ‘position‘[20 50 30 20]...
    ‘backgroundcolor‘[1 1 1]...
    ‘callback‘[...
   ‘if k==‘‘0‘‘‘...                                      %如果输入前是0,那么将它除去
        ‘k=‘‘‘‘;‘...
        ‘end‘...

评论

共有 条评论