subsasgn.m

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

M
22
字号
function p = subsasgn(p,index,val)
% SUBSASGN Define index assignment for agent objects
switch index.type
case '()'
    switch index.subs{:}
    case 1
        p.ID = val;
    case 2
        p.angle = val;
    otherwise
        error('Index out of range')
    end
case '.'
    switch index.subs
    case 'ID'
        p.ID = val;
    case 'angle'
        p.angle = val;
    otherwise
        error('Invalid field name')
    end
end

⌨️ 快捷键说明

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