change_class.m

来自「最新的模式识别分类工具箱,希望对朋友们有用!」· M 代码 · 共 47 行

M
47
字号
function change_class(who_called)

%Change the display of a class, when one of the radio buttons is pressed.
%Used by the manual entry screen.

load synthetic

h0 = findobj('Tag', 'rbtClass0');       
h1 = findobj('Tag', 'rbtClass1');       
h  = findobj('Tag', 'txtCount');
hp = findobj('Tag', 'popNumber');                                                                     
n0 = size(s0,1);
n1 = size(s1,1);

if who_called,
   set(h0, 'Value', not(get(h1, 'Value')));
else
   set(h1, 'Value', not(get(h0, 'Value')));
end


%Set the number of Gaussians (if they exist)
if (get(h0, 'Value'))
   if (n0>0),
	   set(h, 'String', ['There are ' num2str(n0) ' Gaussians in this class'])
		s = cell(n0, 1);                                                                                    
		for i=1:n0,                                                                                         
   		s(i) =  cellstr(num2str(i));                                                                      
		end                                                                                                  
		set(hp, 'String', s')                                                                                 
		set(hp, 'Value', 1)                                                                                 
      set(hp, 'Max', n0);                                                                                  
   end
else
   if (n1>0),
	   set(h, 'String', ['There are ' num2str(n1) ' Gaussians in this class'])
		s = cell(n1, 1);                                                                                    
		for i=1:n1,                                                                                         
   		s(i) =  cellstr(num2str(i));                                                                      
		end                                                                                                  
		set(hp, 'String', s')                                                                                 
		set(hp, 'Value', 1)                                                                                 
      set(hp, 'Max', n1);                                                                                     
   end
end
   
change_gaussian

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?