subsref.m

来自「HERE IS A GOOD PSO TOOL BOX」· M 代码 · 共 33 行

M
33
字号
function B = subsref(A,S)% GPOSYNOMIAL/SUBSREF method%switch length(S)     % number of subscripting levels  case 1             % one subscript reference    switch S.type      case '.'        switch S.subs          case 'op',     B = A.op;          case 'args',   B = A.args;          case 'gpvars', B = A.gpvars;          otherwise            error('Generalized posynomial indexing error.');        end      case '()'        B = A(S.subs{:});      otherwise        error(['Generalized posynomial indexing with ' S.type ' is not supported.']) ;    end  case 2             % two subscript references    if ( strcmp(S(1).type,'.') & strcmp(S(1).subs,'args') & strcmp(S(2).type,'{}') )      B = A.args(S(2).subs{:});      B = B{:};    else      error('This type of generalized posynomial indexing is not supported.');    end  otherwise    error(['Unknown generalized posynomial subscript index.']);end

⌨️ 快捷键说明

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