set.m

来自「Passino所提出的细菌优化算法matlab源程序」· M 代码 · 共 24 行

M
24
字号
function f = set(f,varargin)
% SET Set frogc properties to the specified values
% and return the updated object

property_argin = varargin;      
while length(property_argin) >= 2,  %This takes care of the number of properties that needs to be set
    prop = property_argin{1};
    val = property_argin{2};
    property_argin = property_argin(3:end);
    switch prop
    %fields define by the parents of the frogp object    
    case 'ID'
        f.frogp = set(f.frogp, 'ID', val);      %Calls the set method in @frogp
    case 'angle'
        f.frogp = set(f.frogp, 'angle', val);   %Calls the set method in @frogp
    %additional fields from the child object
    case 'gap'
        f.gap = val;
    case 'supergap'
        f.supergap = val;
    otherwise
        error('Invalid property')
    end
end

⌨️ 快捷键说明

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