subsasgn.m

来自「一个关于adaboost算法的matlab程序」· M 代码 · 共 47 行

M
47
字号
function a = subsasgn(a,s,b)%    A = SUBSASGN(A,S,B) is called for the syntax A(I)=B, A{I}=B, or%%    A.I=B 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/subasgn.m%% Author:      Gunnar R"atsch, Alex Smola% Created:     02/11/98% Updated:     02/21/98% %   G. Raetsch 10.12.99%   Copyright (c) 1998,1999  GMD Berlin - All rights reserved%   THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD FIRST Berlin%   The copyright notice above does not evidence any%   actual or intended publication of this work.%   Please see COPYRIGHT.txt for details.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;Q = [Q, ' = b;'];eval(Q) ;

⌨️ 快捷键说明

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