www.gusucode.com > bigdata 工具箱 matlab源码程序 > bigdata/@tall/subsasgn.m

    function obj = subsasgn(obj, S, b)
%SUBSASGN indexed assignment for tall
%   A = SUBSASGN(A, S, B) is the functional form of assignment.
%
%   Only three limited forms of assignments are supported:
%   A(L, SUBS...) = B
%   where: A is a tall
%          L is a logical tall selecting slices of A
%          SUBS... is zero or more non-tall trailing subscripts
%          B is a non-tall scalar value.
%   A(L, SUBS...) = []
%   where: A is a tall
%          L is a logical tall selecting slices of A
%          SUBS... is zero or more non-tall trailing subscripts
%   A(:, SUBS...) = []
%   where: A is a tall
%          The subscript in the tall dimension is ':'
%          Any other combination of subscripts
%
%   See also subsasgn, tall.

%   Copyright 2015-2016 The MathWorks, Inc.

try
    creating = isnumeric(obj) && isequal(obj, []);
    if creating
        error(message('MATLAB:bigdata:table:CreateUnsupported'));
    end

    deleting = isnumeric(b) && builtin('_isEmptySqrBrktLiteral',b) ...
        && (isscalar(S) || ((length(S) == 2) && isequal(S(2).type,'()')));

    isBraceIndexing = isequal(S(1).type, '{}');

    S = checkTallSubs(S, mfilename, 'MATLAB:bigdata:array:SubsasgnInvalidTallSubscript');

    sz = size(obj);
    if deleting && ~isBraceIndexing % no deleting form of brace indexing
        switch S(1).type
          case '()'
            method = @subsasgnParensDeleting;
          case '.'
            method = @subsasgnDotDeleting;
        end
        obj = method(obj.Adaptor, obj.ValueImpl, sz.ValueImpl, S);
    else
        switch S(1).type
          case '()'
            method = @subsasgnParens;
          case '{}'
            method = @subsasgnBraces;
          case '.'
            method = @subsasgnDot;
        end
        obj = method(obj.Adaptor, obj.ValueImpl, sz.ValueImpl, S, b);
    end
catch E
    throwAsCaller(E);
end
end