subsref.m

来自「一个关于adaboost算法的matlab程序,对开始接触adaboost研究的」· M 代码 · 共 43 行

M
43
字号
function b = subsref(a,s)%    B = SUBSREF(A,S) is called for the syntax A(I), A{I}, or A.I%    when A is an object.  S is a structure array with the fields:%        type -- string containing '()', '{}', or '.' specifying the%                subscript type.%        subs -- Cell array or string containing the actual subscripts.%% File:        @data/subsref.m%% Author:      Gunnar R"atsch, Alex Smola% Created:     02/11/98% Updated:     02/21/98% % Copyright (c) 1998  GMD Berlin - All rights reserved% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD Berlin% The copyright notice above does not evidence any% actual or intended publication of this work.Q = 'a';for i=1:length(s)  if equal(s(i).type, '.')    Q=[Q, '.', s(i).subs];  elseif equal(s(i).type, '()')    tmp = length(s(i).subs);    Q=[Q, '('];    for j=1:(tmp-1)      Q=[Q, 's(', num2str(i), ').subs{', num2str(j), '}, '];    end;    Q=[Q, 's(', num2str(i), ').subs{', num2str(tmp), '})'];  elseif equal(s(i).type, '{}')    tmp = length(s(i).subs);    Q=[Q, '{'];    for j=1:(tmp-1)      Q=[Q, 's(', num2str(i), ').subs{', num2str(j), '}, '];    end;    Q=[Q, 's(', num2str(i), ').subs{', num2str(tmp), '}}'];  end ;end;b=eval(Q) ;

⌨️ 快捷键说明

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