⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 da_sel10.m

📁 珍藏的遗传算法的matlab程序集
💻 M
字号:
%
% da_sel10.m
%
% Display the alternative data selection
% screen.
%
% This form of data selection is only allowed
% when there are less than 18 variables
% in total
%
w1=gcf;
da_front;
drawnow;
[in_tags out_tags]=da_tags(tags,include_var,output_var);
[D L]=size(data);

%
% Print titles
%
text=uicontrol(w1,...
	'style','text',...
	'position',[100 400 50 15],...
	'string','Include',...
	'foregroundcolor',[1 1 1],...
	'backgroundcolor',[0 0 1]);

text=uicontrol(w1,...
	'style','text',...
	'position',[200 400 50 15],...
	'string','Output',...
	'foregroundcolor',[1 1 1],...
	'backgroundcolor',[0 0 1]);

text=uicontrol(w1,...
	'style','text',...
	'position',[300 400 50 15],...
	'string','Input',...
	'backgroundcolor',[0 0 1],...
	'foregroundcolor',[1 1 1]);

%
% Starting at the top of the screen, work down
% and print check boxes
%
% work down in reasonable pixel sizes
%

p=370;
if L < 8
	st=35;
else
	st=round(340/L);
end

for i = 1 : L
	%
	% Variable number
	%
	text(i)=uicontrol(w1,...
		'style','edit',...
		'position',[10 p 80 15],...
		'string',tags(i,:),...
		'foregroundcolor',[1 1 1],...
		'backgroundcolor',[1 0 0],...
		'callback',['tags=da_instg(' num2str(i) ',get(text(' num2str(i) '),''string''),tags);']);

	%
	% Include box
	%
	but(i,1)=uicontrol(w1,...
		'style','radio',...
		'position',[120 p 15 15],...
		'foregroundcolor',[1 1 1],...
		'backgroundcolor',[0 0 0],...
		'callback',[
			['if get(but(' num2str(i) ',1),''value'') == 0;'],...
				['set(but(' num2str(i) ',2),''enable'',''off'');'],...
				['set(but(' num2str(i) ',3),''enable'',''off'');'],...
				['set(but(' num2str(i) ',2),''value'',0);'],...
				['set(but(' num2str(i) ',3),''value'',0);'],...
				['include_var(' num2str(i) ')=0;'],...
			'else;',...
				['set(but(' num2str(i) ',2),''enable'',''on'');'],...
				['set(but(' num2str(i) ',3),''enable'',''on'');'],...
				['set(but(' num2str(i) ',3),''value'',abs(output_var(' num2str(i) ')-1));'],...
				['set(but(' num2str(i) ',2),''value'',output_var(' num2str(i) '));'],...
				['include_var(' num2str(i) ')=1;'],...
			'end;',...
			'[in_tags out_tags]=da_tags(tags,include_var,output_var);']);

	%
	% Output box
	%
	but(i,2)=uicontrol(w1,...
		'style','radio',...
		'position',[220 p 15 15],...
		'foregroundcolor',[1 1 1],...
		'backgroundcolor',[0 0 0],...
		'callback',[
			['output_var(' num2str(i) ')=1;      '],...
			['[in_tags out_tags]=da_tags(tags,include_var,output_var);'],...
			['set(but(' num2str(i) ',3),''value'',0);'],...
			['set(but(' num2str(i) ',2),''value'',1);']]);
	%
	% Input box
	%
	but(i,3)=uicontrol(w1,...
		'style','radio',...
		'position',[320 p 15 15],...
		'foregroundcolor',[1 1 1],...
		'backgroundcolor',[0 0 0],...
		'callback',[
			['output_var(' num2str(i) ') = 0;      '],...
			['[in_tags out_tags]=da_tags(tags,include_var,output_var);'],...
			['set(but(' num2str(i) ',2),''value'',0);'],...
			['set(but(' num2str(i) ',3),''value'',1);']]);


	%
	% Set up the buttons accordingly
	%
	set(but(i,1),'value',include_var(i));

	if output_var(i) == 1
		set(but(i,2),'value',1);
		set(but(i,3),'value',0);
	else
		set(but(i,2),'value',0);
		set(but(i,3),'value',1);
	end

	if include_var(i) == 1
		set(but(i,2),'enable','on');
		set(but(i,3),'enable','on');
	else
		set(but(i,2),'enable','off');
		set(but(i,3),'enable','off');
		set(but(i,2),'value',0);
		set(but(i,3),'value',0);
	end
	p=p-st;
end

%
% Include everything button
%
but1=uicontrol(w1,...
	'style','push',...
	'position',[420 250 150 30],...
	'string','Include Everything',...
	'callback',[
		'include_var=ones(1,L);',...
		'for i = 1 : L;',...
			'set(but(i,2),''value'',output_var(i));',...
			'set(but(i,3),''value'',abs(output_var(i)-1));',...
			'set(but(i,1),''value'',1);',...
			'set(but(i,2),''enable'',''on'');',...
			'set(but(i,3),''enable'',''on'');',...
		'end;']);

%
% All inputs
%
but2=uicontrol(w1,...
	'style','push',...
	'position',[420 200 150 30],...
	'string','All inputs',...
	'callback',[
		'output_var=zeros(1,L);',...
		'for i = 1 : L;',...
			'if include_var(i)==1;',...
				'set(but(i,2),''value'',0);',...
				'set(but(i,3),''value'',1);',...
			'end;',...
		'end;']);

⌨️ 快捷键说明

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