?? set.m
字號:
function c = set(chr,varargin)% SET - Acces to the fields in the chromosome class% Any number of valid properties can be set with one function% call. The syntax for calling the function is:% set(chromosome,'property',value,'property',value,etc..). The% properties are:%% 'name' - the name of the variable% 'fitness' - the value of the variable% 'cdvs' - number of coding bits% 'ddvs' - a vector containing the binary "dna"%% to list the valid properties for a certain object use set(chromosome)tst=nargin;if tst==1 fprintf('Valid properties:\nname \nfitness \ncdvs\nddvs\nid\n') else if ~or(or(tst==3,tst==5),tst==7) error('wrong number of arguments') else for k=1:2:tst-1 switch varargin{k} case 'name' chr.name=varargin{k+1}; case 'fitness' chr.fitness=varargin{k+1}; case 'cdvs' chr.cdvs=varargin{k+1}; case 'ddvs' chr.ddvs=varargin{k+1}; case 'id' chr.id=varargin{k+1}; otherwise error('Unknown method') end end c=chr; endend
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -