gusucode.com > bigdata 工具箱 matlab源码程序 > bigdata/+matlab/+bigdata/+internal/+adaptors/CategoricalAdaptor.m

    %CategoricalAdaptor Adaptor class for categorical data
%   Adapts subsasgn to allow tc(tc=='foo') = 'bar';
%   and disallows flags to MIN/MAX.

% Copyright 2016 The MathWorks, Inc.
classdef CategoricalAdaptor < ...
        matlab.bigdata.internal.adaptors.AbstractAdaptor & ...
        matlab.bigdata.internal.adaptors.GeneralArrayDisplayMixin & ...
        matlab.bigdata.internal.adaptors.GeneralArrayParenIndexingMixin & ...
        matlab.bigdata.internal.adaptors.NoCellIndexingMixin

    methods
        
        function obj = CategoricalAdaptor()
            obj@matlab.bigdata.internal.adaptors.AbstractAdaptor('categorical');
        end

        function names = getProperties(~)
            names = {};
        end

        function out = subsasgnParens(obj, pa, szPa, S, b)
        % For categorical SUBSASGN, if 'b' is a char-vector, wrap it in a cell before
        % calling the mixin version of SUBSASGN.
            if ischar(b)
                b = {b};
            end
            out = subsasgnParens@matlab.bigdata.internal.adaptors.GeneralArrayParenIndexingMixin(...
                obj, pa, szPa, S, b);
        end

        function [nanFlagCell, precisionFlagCell] = interpretReductionFlags(~, FCN_NAME, flags)
        % Categoricals support no reduction flags.
            if ~isempty(flags)
                error(message('MATLAB:bigdata:array:CategoricalReductionFlagNotSupported', ...
                              FCN_NAME, strjoin(flags)));
            end
            nanFlagCell = {};
            precisionFlagCell = {};
        end
    end
end