資源簡介
基于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‘...
評論
共有 條評論