📄 get.m
字号:
function varargout =get(gen,varargin)
% GET - Returns the values of the design variable corresponding to
% the property list. Any number of properties can be returned with one
% function call.
%
% [val1 val2 etc...]=get(gene,'property','property',etc..).
% The properties are:
%
% 'name' - the name of the variable
% 'value' - the value of the variable
% 'bits' - number of coding bits
% 'dna' - a vector containing the binary "dna"
% 'l_limit' - the lower limit for a cdv
% 'u_limit' - the upper limit for a cdv
% 'p_val' - the possible values for a ddv [val1 val2 etc...]
%
% to list the valid properties for a certain object use get(gene)
tst=nargin;
if tst==1
fprintf('Valid properties:\nname \nvalue \nbits\ndna\n')
else
if ~or(or(tst==2,tst==3),tst==4)
error('bad number of arguments')
end
for k=1:tst-1
switch varargin{k}
case 'name'
varargout{k}=gen.name;
case 'value'
varargout{k}=gen.value;
case 'bits'
varargout{k}=gen.bits;
case 'dna'
varargout{k}=gen.dna;
otherwise
txt=strcat('bad argument:',varargin{k});
error(txt)
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -