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

    function tableAdaptors = getAdaptorsFromDummyTable(Tout, knownClass)
%getAdaptorsFromDummyTable gets adaptors for tall table from a table prototype.

%   Copyright 2016 The MathWorks, Inc.

if knownClass
    % We know the class of each variable of the original tall table. 
    % We can use the class of variables from the table prototype.  
    tableAdaptors = matlab.bigdata.internal.adaptors.getAdaptor(Tout);
else
    % Create adapators when the original tall table does not have complete
    % class info. In this case, all generic tyes info can be wrong. But the
    % strong types would still be correct.
    varNames = Tout.Properties.VariableNames;
    % Create adaptors for each variable
    cellClass = varfun(@getClass,Tout,'OutputFormat','cell');
    adaptors = cellfun(@(x)matlab.bigdata.internal.adaptors.getAdaptorForType(x), ...
        cellClass, 'UniformOutput', false);
    % Create table adaptor
    tableAdaptors = matlab.bigdata.internal.adaptors.TableAdaptor(varNames,adaptors);
end
end

function classInfo = getClass(x)
% replace generic class info with ''
if isnumeric(x) || ischar(x) || islogical(x) || iscell(x)
    classInfo = '';
else
    classInfo = class(x);
end
end