?? selbck.m
字號(hào):
function selbck(source,eventdata)
%This callback function is used to responsed the radiobutton selection change
name = get(eventdata.NewValue,'String');
hE1 = getappdata(gcf,'hE1');
hE2 = getappdata(gcf,'hE2');
hE3 = getappdata(gcf,'hE3');
hE4 = getappdata(gcf,'hE4');
hE5 = getappdata(gcf,'hE5');
hE6 = getappdata(gcf,'hE6');
hE7 = getappdata(gcf,'hE7');
hE8 = getappdata(gcf,'hE8');
hE9 = getappdata(gcf,'hE9');
hE10 = getappdata(gcf,'hE10');
heditarray = [hE1 hE2 hE3 hE4 hE5 hE6 hE7 hE8 hE9 hE10];
hS1 = getappdata(gcf,'hS1');
hS2 = getappdata(gcf,'hS2');
hS3 = getappdata(gcf,'hS3');
hS4 = getappdata(gcf,'hS4');
hS5 = getappdata(gcf,'hS5');
hS6 = getappdata(gcf,'hS6');
hS7 = getappdata(gcf,'hS7');
hS8 = getappdata(gcf,'hS8');
hS9 = getappdata(gcf,'hS9');
hS10 = getappdata(gcf,'hS10');
hstaticarray = [hS1 hS2 hS3 hS4 hS5 hS6 hS7 hS8 hS9 hS10];
clearall(heditarray); %firstly, call the function clearall to clear all edit controllors
visibleall(heditarray,hstaticarray); %secondly, make all the controllors visible
%thirdly, change the strings of the static, and hide some controllors
switch (name)
case 'Length'
setappdata(gcf,'myoption',1);
namearray = str2mat({'m','dm','cm','mm','km','foot','yard','inch','nmi','mile'});
case 'Area'
setappdata(gcf,'myoption',2);
namearray = str2mat({'sq.metres','sq.decimetres','sq.centimetres','sq.kilometres','sq.foot','sq.yard','are','hectare','sq.mile'});
case 'Weight'
setappdata(gcf,'myoption',3);
namearray = str2mat({'kg','g','jin','liang','ton','dram','ounce','pound','hundredweight','grain'});
case 'Volume'
setappdata(gcf,'myoption',4);
namearray = str2mat({'cu.metre','cu.decimetres','cu.centimetres','cu.foot','cu.yard','litre','gallon','quart'});
end
setname(heditarray,hstaticarray,namearray);
return;
function setname(heditarray,hstaticarray,namecell)
% set the name of all static text
% input:
% heditarray : the hand array of the edit
% hstaticarray : the hand array of the static text
% namearray : the name cell of the static text
%
% Note: if the number of namearray is less than that of harray, the remain edits shouble be hidden.
len = length(heditarray);
row = size(namecell,1);
for ii = 1:row
set(hstaticarray(ii),'String',namecell(ii,:))
end
if(row<len)
for ii = row+1:len
set(heditarray(ii),'visible','off');
set(hstaticarray(ii),'visible','off');
end
end
return;
%make all of the edits and static visible
function visibleall(heditarray,hstaticarray)
len = length(heditarray);
for ii = 1:len
set(heditarray(ii),'visible','on');
set(hstaticarray(ii),'visible','on');
end
return;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -