?? shili63.m
字號:
h0=figure('toolbar','none',...
'position',[200 150 350 200],...
'name','實例63');
choose=1;
e1=uicontrol('parent',h0,...
'units','points',...
'tag','e1',...
'style','edit',...
'backgroundcolor',[1 1 1],...
'min',0,...
'max',2,...
'fontsize',12,...
'horizontalalignment','left',...
'position',[20 20 120 100]);
t1=uicontrol('parent',h0,...
'units','points',...
'tag','t1',...
'style','text',...
'string','請輸入字母(大小寫皆可):',...
'fontsize',10,...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[20 125 120 15]);
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','開始統計',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[180 100 60 20],...
'callback',[...
's=get(e1,''string'');,',...
'n=length(s);,',...
'jb=0;,',...
'jl=0;,',...
'for i=1:n,',...
'if (abs(s(i))>64)&(abs(s(i))<91),',...
'jb=jb+1;,',...
'end,',...
'if (abs(s(i))>96)&(abs(s(i))<123),',...
'jl=jl+1;,',...
'end,',...
'end,',...
'j=jb+jl;,',...
'if choose==1,',...
'msgbox([''共有字母'',num2str(j),''個!'',''其中大寫字母'',num2str(jb),''個!''],''統計結果''),',...
'end,',...
'if choose==2,',...
'msgbox([''共有字母'',num2str(j),''個!'',''其中小寫字母'',num2str(jl),''個!''],''統計結果'');,',...
'end']);
u1=uimenu('parent',h0,...
'label','字母分類',...
'backgroundcolor',[0.75 0.75 0.75],...
'tag','u1');
u11=uimenu('parent',u1,...
'label','大寫字母',...
'backgroundcolor',[0.75 0.75 0.75],...
'tag','u11',...
'checked','on',...
'callback',[...
'set(u11,''checked'',''on'');,',...
'set(u12,''checked'',''off'');,',...
'choose=1;']);
u12=uimenu('parent',u1,...
'label','小寫字母',...
'backgroundcolor',[0.75 0.75 0.75],...
'tag','u12',...
'callback',[...
'set(u12,''checked'',''on'');,',...
'set(u11,''checked'',''off'');,',...
'choose=2;']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','清除',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[180 60 60 20],...
'callback','set(e1,''string'','''')');
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'style','pushbutton',...
'string','關閉',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[180 20 60 20],...
'callback','close');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -