subsref.m

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

M
32
字号
function B = subsref(A,S)% POSYNOMIAL/SUBSREF method%% one subscripting levelif length(S) == 1  switch S.type    case '.'      switch S.subs        case 'gpvars'          B = A.gpvars;        case 'mono_terms'          B = A.mono_terms;        case 'monomials'          B = A.monomials;        otherwise          error('posynomial indexing error');      end    case '()'      B = A(S.subs{:});    otherwise      error(['(posy indexation with ' S.type ' not supported)']) ;  end% two subscripting levelselseif length(S) == 2  if ( strcmp(S(1).subs,'monomials') && strcmp(S(2).type,'{}') )     B = A.monomials{S(2).subs{:}};  endelse  error('Such posynomial indexing is not supported');end

⌨️ 快捷键说明

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